mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-02 10:59:14 +01:00
Update cd-downloads.ps1
This commit is contained in:
parent
4de937934d
commit
89194a0286
@ -5,7 +5,7 @@
|
|||||||
This PowerShell script changes the working directory to the user's downloads folder.
|
This PowerShell script changes the working directory to the user's downloads folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-downloads
|
PS> ./cd-downloads
|
||||||
📂/home/Joe/Downloads
|
📂C:\Users\Joe\Downloads
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -13,11 +13,15 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$HOME/Downloads"
|
if ($IsLinux) {
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
$Path = Resolve-Path "$HOME/Downloads"
|
||||||
|
} else {
|
||||||
|
$Path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
||||||
|
}
|
||||||
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Downloads folder at 📂$Path doesn't exist (yet)"
|
throw "Downloads folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user