mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-21 23:43:25 +01: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 {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "$HOME/Desktop"
|
||||
$Path = Resolve-Path "~/Desktop"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Desktop folder at 📂$Path doesn't exist (yet)"
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
throw "User's desktop folder at 📂$Path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
|
@ -14,16 +14,16 @@
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "$HOME/Downloads"
|
||||
$Path = Resolve-Path "~/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)"
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
throw "User's downloads folder at 📂$Path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
|
@ -14,16 +14,16 @@
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Path = Resolve-Path "$HOME/Music"
|
||||
$Path = Resolve-Path "~/Music"
|
||||
} else {
|
||||
$Path = [Environment]::GetFolderPath('MyMusic')
|
||||
}
|
||||
if (-not(Test-Path "$Path" -pathType container)) {
|
||||
throw "Music folder at 📂$Path doesn't exist (yet)"
|
||||
if (Test-Path "$Path" -pathType container) {
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
}
|
||||
Set-Location "$Path"
|
||||
"📂$Path"
|
||||
exit 0 # success
|
||||
throw "User's music folder at 📂$Path doesn't exist (yet)"
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user