Updated cd-repos.ps1

This commit is contained in:
Markus Fleschutz 2025-03-17 10:30:22 +01:00
parent edc57b01ef
commit 5873d0dc1c

View File

@ -1,6 +1,6 @@
<#
.SYNOPSIS
Sets the working directory to the Git repos folder
Sets the working dir to the repos folder
.DESCRIPTION
This PowerShell script changes the working directory to the folder for Git repositories.
.EXAMPLE
@ -24,11 +24,12 @@ try {
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default
} elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
} else {
throw "No folder for Git repositories yet (in home or root directory)"
throw "No folder found for Git repositories (in home or root directory) - Please create one."
}
$path = Resolve-Path $path
Set-Location "$path"
"📂$path"
$subfolders = Get-ChildItem $path -attributes Directory
"📂$path entered, it has $($subfolders.Count) subfolders."
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"