mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-09 18:14:36 +02:00
Updated cd-repos.ps1
This commit is contained in:
parent
edc57b01ef
commit
5873d0dc1c
@ -1,6 +1,6 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to the Git repos folder
|
Sets the working dir to the repos folder
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script changes the working directory to the folder for Git repositories.
|
This PowerShell script changes the working directory to the folder for Git repositories.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
@ -24,11 +24,12 @@ try {
|
|||||||
} elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default
|
} 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
|
} elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD
|
||||||
} else {
|
} 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
|
$path = Resolve-Path $path
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
"📂$path"
|
$subfolders = Get-ChildItem $path -attributes Directory
|
||||||
|
"📂$path entered, it has $($subfolders.Count) subfolders."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ Error: $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user