mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-11 05:43:53 +02:00
Updated the cd-*.ps1 scripts
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user