Updated the cd-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2025-07-09 14:19:53 +02:00
parent d3e77308a8
commit 51b541e0de
30 changed files with 115 additions and 65 deletions

View File

@ -2,9 +2,9 @@
.SYNOPSIS
Sets the working directory to one level up
.DESCRIPTION
This PowerShell script changes the working directory to one directory level up.
This PowerShell script changes the current working directory to one directory level up.
.EXAMPLE
PS> .\cd-up
PS> .\cd-up.ps1
📂C:\Users
.LINK
https://github.com/fleschutz/PowerShell
@ -12,6 +12,8 @@
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
try {
$path = Resolve-Path ".."
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
@ -19,6 +21,6 @@ try {
"📂$path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ ERROR: $($Error[0])"
exit 1
}