cd-repos
Sets the working dir to the repos folder
#requires -version 5.1
try {
if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos"
} elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos"
} elseif (Test-Path "~/Repositories" -pathType container) { $path = "~/Repositories"
} elseif (Test-Path "~/repositories" -pathType container) { $path = "~/repositories"
} elseif (Test-Path "~/Git" -pathType container) { $path = "~/Git"
} elseif (Test-Path "~/git" -pathType container) { $path = "~/git"
} elseif (Test-Path "/Repos" -pathType container) { $path = "/Repos"
} elseif (Test-Path "/repos" -pathType container) { $path = "/repos"
} elseif (Test-Path "/Repositories" -pathType container) { $path = "/Repositories"
} elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories"
} elseif (Test-Path "/Git" -pathType container) { $path = "/Git"
} elseif (Test-Path "/git" -pathType container) { $path = "/git"
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos"
} elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos"
} elseif (Test-Path "D:/Repositories" -pathType container) { $path = "D:/Repositories"
} elseif (Test-Path "D:/Git" -pathType container) { $path = "D:/Git"
} elseif (Test-Path "D:/git" -pathType container) { $path = "D:/git"
} else { throw "Found no folder for Git repositories (in home or root directory) - Please create one." }
$path = Resolve-Path $path
Set-Location "$path"
$folders = Get-ChildItem $path -attributes Directory
"📂$path entered, has $($folders.Count) subfolders."
exit 0
} catch {
throw
}This script has no configurable parameters.