Updated cd-repos.ps1 and cd-scripts.ps1

This commit is contained in:
Markus Fleschutz
2024-03-06 08:25:34 +01:00
parent 6625d4a909
commit 95e3305c9d
2 changed files with 24 additions and 18 deletions

View File

@ -5,7 +5,7 @@
This PowerShell script changes the working directory to the PowerShell scripts folder.
.EXAMPLE
PS> ./cd-scripts
📂C:\Users\Markus\source\repos\PowerShell\scripts
📂C:\Users\Markus\Repos\PowerShell\scripts
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -13,10 +13,10 @@
#>
try {
$Path = Resolve-Path "$PSScriptRoot"
if (-not(Test-Path "$Path" -pathType container)) { throw "PowerShell scripts folder at 📂$Path doesn't exist (yet)" }
Set-Location "$Path"
"📂$Path"
$path = Resolve-Path "$PSScriptRoot"
if (-not(Test-Path "$path" -pathType container)) { throw "PowerShell scripts folder at 📂$path doesn't exist (yet)" }
Set-Location "$path"
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"