mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 01:14:16 +01:00
Updated the cd-*.ps1 scripts
This commit is contained in:
parent
6419712ff2
commit
bb01ef8cf5
@ -13,12 +13,12 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
$path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Autostart folder at 📂$Path doesn't exist (yet)"
|
throw "Autostart folder at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Desktop"
|
$path = Resolve-Path "~/Desktop"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
$path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||||
}
|
}
|
||||||
if (Test-Path "$Path" -pathType container) {
|
if (Test-Path "$path" -pathType container) {
|
||||||
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)"
|
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,15 +14,15 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Documents"
|
$path = Resolve-Path "~/Documents"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyDocuments')
|
$path = [Environment]::GetFolderPath('MyDocuments')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Documents folder at 📂$Path doesn't exist (yet)"
|
throw "Documents folder at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/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 (Test-Path "$Path" -pathType container) {
|
if (Test-Path "$path" -pathType container) {
|
||||||
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)"
|
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,7 +14,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$path = Resolve-Path "~/Dropbox"
|
$path = Resolve-Path "~/Dropbox"
|
||||||
if (-not(Test-Path "$path" -pathType container)) { throw "No Dropbox folder at 📂$Path - is Dropbox installed?" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "No Dropbox folder at 📂$path - is Dropbox installed?" }
|
||||||
Set-Location "$path"
|
Set-Location "$path"
|
||||||
"📂$path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinx) {
|
if ($IsLinx) {
|
||||||
$Path = "/etc"
|
$path = "/etc"
|
||||||
} else {
|
} else {
|
||||||
$Path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
$path = Resolve-Path "$env:WINDIR\System32\drivers\etc"
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "/etc directory at 📂$Path doesn't exist (yet)"
|
throw "/etc directory at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = [Environment]::GetFolderPath('Fonts')
|
$path = [Environment]::GetFolderPath('Fonts')
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$path" -pathType container)) {
|
||||||
throw "Fonts folder at 📂$Path doesn't exist (yet)"
|
throw "Fonts folder at 📂$path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -19,9 +19,9 @@ function GetLogsDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = GetLogsDir
|
$path = GetLogsDir
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Music"
|
$path = Resolve-Path "~/Music"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyMusic')
|
$path = [Environment]::GetFolderPath('MyMusic')
|
||||||
}
|
}
|
||||||
if (Test-Path "$Path" -pathType container) {
|
if (Test-Path "$path" -pathType container) {
|
||||||
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)"
|
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
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Pictures"
|
$path = Resolve-Path "~/Pictures"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyPictures')
|
$path = [Environment]::GetFolderPath('MyPictures')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Public"
|
$path = Resolve-Path "~/Public"
|
||||||
} else {
|
} else {
|
||||||
$Path = Resolve-Path "~/../Public"
|
$path = Resolve-Path "~/../Public"
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Public folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Public folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -20,7 +20,7 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$path = "$HOME/.local/share/Trash/"
|
$path = "~/.local/share/Trash/"
|
||||||
} else {
|
} else {
|
||||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
|
if (Test-Path "~/Repos/" -pathType Container) { # try short name
|
||||||
$path = "$HOME/Repos/"
|
$path = "~/Repos/"
|
||||||
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
|
} elseif (Test-Path "~/repos/" -pathType Container) {
|
||||||
$path = "$HOME/repos/"
|
$path = "~/repos/"
|
||||||
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
|
} elseif (Test-Path "~/Repositories/" -pathType Container) { # try long name
|
||||||
$path = "$HOME/Repositories/"
|
$path = "~/Repositories/"
|
||||||
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
|
} elseif (Test-Path "~/source/repos/" -pathType Container) { # try Visual Studio default
|
||||||
$path = "$HOME/source/repos/"
|
$path = "~/source/repos/"
|
||||||
} elseif (Test-Path "/Repos/" -pathType Container) {
|
} elseif (Test-Path "/Repos/" -pathType Container) {
|
||||||
$path = "/Repos/"
|
$path = "/Repos/"
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) { $Path = "/" } else { $Path = "C:\" }
|
if ($IsLinux) { $path = "/" } else { $path = "C:\" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,21 +14,21 @@
|
|||||||
|
|
||||||
function GetScreenshotsFolder {
|
function GetScreenshotsFolder {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = "$HOME/Pictures"
|
$path = "~/Pictures"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at $Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
|
||||||
if (Test-Path "$Path/Screenshots" -pathType container) { $Path = "$Path/Screenshots" }
|
if (Test-Path "$path/Screenshots" -pathType container) { $path = "$path/Screenshots" }
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyPictures')
|
$path = [Environment]::GetFolderPath('MyPictures')
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Pictures folder at $Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at $path doesn't exist (yet)" }
|
||||||
if (Test-Path "$Path\Screenshots" -pathType container) { $Path = "$Path\Screenshots" }
|
if (Test-Path "$path\Screenshots" -pathType container) { $path = "$path\Screenshots" }
|
||||||
}
|
}
|
||||||
return $Path
|
return $path
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = GetScreenshotsFolder
|
$path = GetScreenshotsFolder
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -20,10 +20,10 @@ function GetTempDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = GetTempDir
|
$path = GetTempDir
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Temporary folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Temporary folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "~/Templates"
|
$path = Resolve-Path "~/Templates"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('Templates')
|
$path = [Environment]::GetFolderPath('Templates')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Templates folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Templates folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -20,7 +20,7 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$path = "$HOME/.local/share/Trash/"
|
$path = "~/.local/share/Trash/"
|
||||||
} else {
|
} else {
|
||||||
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
$path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)"
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path ".."
|
$path = Resolve-Path ".."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "../.."
|
$path = Resolve-Path "../.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "../../.."
|
$path = Resolve-Path "../../.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "../../../.."
|
$path = Resolve-Path "../../../.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$HOME/.."
|
$path = Resolve-Path "~/.."
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Users directory at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Users directory at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = Resolve-Path "$HOME/Videos"
|
$path = Resolve-Path "~/Videos"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('MyVideos')
|
$path = [Environment]::GetFolderPath('MyVideos')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Videos folder at 📂$Path doesn't exist (yet)" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Videos folder at 📂$path doesn't exist (yet)" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = Resolve-Path "$env:WINDIR"
|
$path = Resolve-Path "$env:WINDIR"
|
||||||
if (-not(Test-Path "$Path" -pathType container)) { throw "Windows directory at 📂$Path doesn't exist" }
|
if (-not(Test-Path "$path" -pathType container)) { throw "Windows directory at 📂$path doesn't exist" }
|
||||||
Set-Location "$Path"
|
Set-Location "$path"
|
||||||
"📂$Path"
|
"📂$path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user