mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-13 06:27:16 +02:00
Updated cd-docs.ps1
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working dir to the documents folder
|
Sets the working dir to the documents folder
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script sets the current working directory to the documents folder.
|
This PowerShell script changes the current working directory to the documents folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-docs.ps1
|
PS> ./cd-docs.ps1
|
||||||
📂C:\Users\Markus\Documents with 3 files and 0 folders entered.
|
📂C:\Users\Markus\Documents with 3 files and 0 folders entered.
|
||||||
@ -15,7 +15,7 @@
|
|||||||
try {
|
try {
|
||||||
if ($IsLinux -or $IsMacOS) {
|
if ($IsLinux -or $IsMacOS) {
|
||||||
if (-not(Test-Path "~/Documents" -pathType container)) {
|
if (-not(Test-Path "~/Documents" -pathType container)) {
|
||||||
throw "No 'Documents' folder in your home directory yet"
|
throw "Your home directory has no 'Documents' folder yet"
|
||||||
}
|
}
|
||||||
$path = Resolve-Path "~/Documents"
|
$path = Resolve-Path "~/Documents"
|
||||||
} else {
|
} else {
|
||||||
@ -30,6 +30,6 @@ try {
|
|||||||
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0])"
|
"⚠️ ERROR: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user