mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-03 03:19:16 +01:00
Update cd-home.ps1 and list-workdir.ps1
This commit is contained in:
parent
1cca88c32b
commit
c8efe1f4ec
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's home directory
|
||||
Sets the working directory to the user's home folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's home directory.
|
||||
.EXAMPLE
|
||||
@ -13,13 +13,13 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME"
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Home directory at 📂$Path doesn't exist (yet)"
|
||||
$Path = Resolve-Path -Path "~"
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
throw "User's home folder at 📂$Path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
|
@ -13,7 +13,7 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = Resolve-Path "$PWD"
|
||||
$Path = Resolve-Path -Path "$PWD"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user