Updated cd-ssh.ps1

This commit is contained in:
Markus Fleschutz
2025-07-08 16:08:15 +02:00
parent 5b8766d233
commit e49ee018f3

View File

@ -2,7 +2,7 @@
.SYNOPSIS .SYNOPSIS
Sets the working dir to the SSH folder Sets the working dir to the SSH folder
.DESCRIPTION .DESCRIPTION
This PowerShell script sets the current working directory to the user's secure shell (SSH) folder. This PowerShell script changes the current working directory to the user's secure shell (SSH) folder.
.EXAMPLE .EXAMPLE
PS> ./cd-ssh.ps1 PS> ./cd-ssh.ps1
📂C:\Users\Markus\.ssh with 4 files entered. 📂C:\Users\Markus\.ssh with 4 files entered.
@ -15,7 +15,7 @@
try { try {
$path = "~/.ssh" $path = "~/.ssh"
if (-not(Test-Path "$path" -pathType container)) { if (-not(Test-Path "$path" -pathType container)) {
throw "No '.ssh' folder in your home directory yet - Is SSH installed?" throw "Your home directory has no '.ssh' folder yet - Please install SSH."
} }
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
Set-Location "$path" Set-Location "$path"
@ -23,6 +23,6 @@ try {
"📂$path with $($files.Count) files entered." "📂$path with $($files.Count) files entered."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ ERROR: $($Error[0])"
exit 1 exit 1
} }