Update cd-home.ps1 and list-workdir.ps1

This commit is contained in:
Markus Fleschutz 2022-12-28 15:24:29 +01:00
parent 1cca88c32b
commit c8efe1f4ec
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the user's home directory Sets the working directory to the user's home folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's home directory. This PowerShell script changes the working directory to the user's home directory.
.EXAMPLE .EXAMPLE
@ -13,13 +13,13 @@
#> #>
try { try {
$Path = Resolve-Path "$HOME" $Path = Resolve-Path -Path "~"
if (-not(Test-Path "$Path" -pathType container)) { if (Test-Path "$Path" -pathType container) {
throw "Home directory at 📂$Path doesn't exist (yet)"
}
Set-Location "$Path" Set-Location "$Path"
"📂$Path" "📂$Path"
exit 0 # success exit 0 # success
}
throw "User's home folder at 📂$Path doesn't exist (yet)"
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1

View File

@ -13,7 +13,7 @@
#> #>
try { try {
$Path = Resolve-Path "$PWD" $Path = Resolve-Path -Path "$PWD"
"📂$Path" "📂$Path"
exit 0 # success exit 0 # success
} catch { } catch {