mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-14 08:57:04 +02:00
Update cd-desktop.ps1, cd-downloads.ps1, and cd-music.ps1
This commit is contained in:
parent
c8efe1f4ec
commit
3fdab43903
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Desktop"
|
$Path = Resolve-Path "~/Desktop"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (Test-Path "$Path" -pathType container) {
|
||||||
throw "Desktop folder at 📂$Path doesn't exist (yet)"
|
|
||||||
}
|
|
||||||
Set-Location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
}
|
||||||
|
throw "User's desktop 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
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Downloads"
|
$Path = Resolve-Path "~/Downloads"
|
||||||
} else {
|
} else {
|
||||||
$Path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
$Path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (Test-Path "$Path" -pathType container) {
|
||||||
throw "Downloads folder at 📂$Path doesn't exist (yet)"
|
|
||||||
}
|
|
||||||
Set-Location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
}
|
||||||
|
throw "User's downloads 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
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Music"
|
$Path = Resolve-Path "~/Music"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyMusic')
|
$Path = [Environment]::GetFolderPath('MyMusic')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (Test-Path "$Path" -pathType container) {
|
||||||
throw "Music folder at 📂$Path doesn't exist (yet)"
|
|
||||||
}
|
|
||||||
Set-Location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
}
|
||||||
|
throw "User's music 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user