diff --git a/scripts/cd-autostart.ps1 b/scripts/cd-autostart.ps1 index 187536c9..96115f24 100755 --- a/scripts/cd-autostart.ps1 +++ b/scripts/cd-autostart.ps1 @@ -13,12 +13,12 @@ #> try { - $Path = Resolve-Path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup" - if (-not(Test-Path "$Path" -pathType container)) { - throw "Autostart folder at 📂$Path doesn't exist (yet)" + $path = Resolve-Path "~/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup" + if (-not(Test-Path "$path" -pathType container)) { + throw "Autostart folder at 📂$path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-desktop.ps1 b/scripts/cd-desktop.ps1 index a66d94a3..90c2fcd5 100755 --- a/scripts/cd-desktop.ps1 +++ b/scripts/cd-desktop.ps1 @@ -14,16 +14,16 @@ try { if ($IsLinux) { - $Path = Resolve-Path "~/Desktop" + $path = Resolve-Path "~/Desktop" } else { - $Path = [Environment]::GetFolderPath('DesktopDirectory') + $path = [Environment]::GetFolderPath('DesktopDirectory') } - if (Test-Path "$Path" -pathType container) { - Set-Location "$Path" - "📂$Path" + if (Test-Path "$path" -pathType container) { + Set-Location "$path" + "📂$path" 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 { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 diff --git a/scripts/cd-docs.ps1 b/scripts/cd-docs.ps1 index d4182982..acea329e 100755 --- a/scripts/cd-docs.ps1 +++ b/scripts/cd-docs.ps1 @@ -14,15 +14,15 @@ try { if ($IsLinux) { - $Path = Resolve-Path "$HOME/Documents" + $path = Resolve-Path "~/Documents" } else { - $Path = [Environment]::GetFolderPath('MyDocuments') + $path = [Environment]::GetFolderPath('MyDocuments') } - if (-not(Test-Path "$Path" -pathType container)) { - throw "Documents folder at 📂$Path doesn't exist (yet)" + if (-not(Test-Path "$path" -pathType container)) { + throw "Documents folder at 📂$path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-downloads.ps1 b/scripts/cd-downloads.ps1 index f5922521..c2714829 100755 --- a/scripts/cd-downloads.ps1 +++ b/scripts/cd-downloads.ps1 @@ -14,16 +14,16 @@ try { if ($IsLinux) { - $Path = Resolve-Path "~/Downloads" + $path = Resolve-Path "~/Downloads" } 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) { - Set-Location "$Path" - "📂$Path" + if (Test-Path "$path" -pathType container) { + Set-Location "$path" + "📂$path" 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 { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 diff --git a/scripts/cd-dropbox.ps1 b/scripts/cd-dropbox.ps1 index ac4259f2..15c7c981 100755 --- a/scripts/cd-dropbox.ps1 +++ b/scripts/cd-dropbox.ps1 @@ -14,7 +14,7 @@ try { $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" "📂$path" exit 0 # success diff --git a/scripts/cd-etc.ps1 b/scripts/cd-etc.ps1 index dd7f632b..0eaff8a0 100755 --- a/scripts/cd-etc.ps1 +++ b/scripts/cd-etc.ps1 @@ -14,15 +14,15 @@ try { if ($IsLinx) { - $Path = "/etc" + $path = "/etc" } else { - $Path = Resolve-Path "$env:WINDIR\System32\drivers\etc" + $path = Resolve-Path "$env:WINDIR\System32\drivers\etc" } - if (-not(Test-Path "$Path" -pathType container)) { - throw "/etc directory at 📂$Path doesn't exist (yet)" + if (-not(Test-Path "$path" -pathType container)) { + throw "/etc directory at 📂$path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-fonts.ps1 b/scripts/cd-fonts.ps1 index aed5c677..d755eca8 100755 --- a/scripts/cd-fonts.ps1 +++ b/scripts/cd-fonts.ps1 @@ -13,12 +13,12 @@ #> try { - $Path = [Environment]::GetFolderPath('Fonts') - if (-not(Test-Path "$Path" -pathType container)) { - throw "Fonts folder at 📂$Path doesn't exist (yet)" + $path = [Environment]::GetFolderPath('Fonts') + if (-not(Test-Path "$path" -pathType container)) { + throw "Fonts folder at 📂$path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-logs.ps1 b/scripts/cd-logs.ps1 index ce4ca441..20caf9fa 100755 --- a/scripts/cd-logs.ps1 +++ b/scripts/cd-logs.ps1 @@ -19,11 +19,11 @@ function GetLogsDir { } try { - $Path = GetLogsDir - Set-Location "$Path" - "📂$Path" + $path = GetLogsDir + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 -} \ No newline at end of file +} diff --git a/scripts/cd-music.ps1 b/scripts/cd-music.ps1 index b6042932..daa69fc9 100755 --- a/scripts/cd-music.ps1 +++ b/scripts/cd-music.ps1 @@ -14,16 +14,16 @@ try { if ($IsLinux) { - $Path = Resolve-Path "~/Music" + $path = Resolve-Path "~/Music" } else { - $Path = [Environment]::GetFolderPath('MyMusic') + $path = [Environment]::GetFolderPath('MyMusic') } - if (Test-Path "$Path" -pathType container) { - Set-Location "$Path" - "📂$Path" + if (Test-Path "$path" -pathType container) { + Set-Location "$path" + "📂$path" 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 { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 diff --git a/scripts/cd-pics.ps1 b/scripts/cd-pics.ps1 index 8a944735..b1ebbb1d 100755 --- a/scripts/cd-pics.ps1 +++ b/scripts/cd-pics.ps1 @@ -14,13 +14,13 @@ try { if ($IsLinux) { - $Path = Resolve-Path "$HOME/Pictures" + $path = Resolve-Path "~/Pictures" } 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)" } - Set-Location "$Path" - "📂$Path" + if (-not(Test-Path "$path" -pathType container)) { throw "Pictures folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-public.ps1 b/scripts/cd-public.ps1 index 827e7cc1..4876174f 100755 --- a/scripts/cd-public.ps1 +++ b/scripts/cd-public.ps1 @@ -14,13 +14,13 @@ try { if ($IsLinux) { - $Path = Resolve-Path "~/Public" + $path = Resolve-Path "~/Public" } 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)" } - Set-Location "$Path" - "📂$Path" + if (-not(Test-Path "$path" -pathType container)) { throw "Public folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-recycle-bin.ps1 b/scripts/cd-recycle-bin.ps1 index 3a9b81fe..eecb1c24 100755 --- a/scripts/cd-recycle-bin.ps1 +++ b/scripts/cd-recycle-bin.ps1 @@ -20,7 +20,7 @@ function GetCurrentUserSID { [CmdletBinding()] param() try { if ($IsLinux) { - $path = "$HOME/.local/share/Trash/" + $path = "~/.local/share/Trash/" } else { $path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)" } diff --git a/scripts/cd-repos.ps1 b/scripts/cd-repos.ps1 index 879f0733..6887d421 100755 --- a/scripts/cd-repos.ps1 +++ b/scripts/cd-repos.ps1 @@ -15,14 +15,14 @@ #> try { - if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name - $path = "$HOME/Repos/" - } elseif (Test-Path "$HOME/repos/" -pathType Container) { - $path = "$HOME/repos/" - } elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name - $path = "$HOME/Repositories/" - } elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default - $path = "$HOME/source/repos/" + if (Test-Path "~/Repos/" -pathType Container) { # try short name + $path = "~/Repos/" + } elseif (Test-Path "~/repos/" -pathType Container) { + $path = "~/repos/" + } elseif (Test-Path "~/Repositories/" -pathType Container) { # try long name + $path = "~/Repositories/" + } elseif (Test-Path "~/source/repos/" -pathType Container) { # try Visual Studio default + $path = "~/source/repos/" } elseif (Test-Path "/Repos/" -pathType Container) { $path = "/Repos/" } else { diff --git a/scripts/cd-root.ps1 b/scripts/cd-root.ps1 index e473b7ec..2dab1d93 100755 --- a/scripts/cd-root.ps1 +++ b/scripts/cd-root.ps1 @@ -13,9 +13,9 @@ #> try { - if ($IsLinux) { $Path = "/" } else { $Path = "C:\" } - Set-Location "$Path" - "📂$Path" + if ($IsLinux) { $path = "/" } else { $path = "C:\" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-screenshots.ps1 b/scripts/cd-screenshots.ps1 index daf39c34..ff9463c0 100755 --- a/scripts/cd-screenshots.ps1 +++ b/scripts/cd-screenshots.ps1 @@ -14,23 +14,23 @@ function GetScreenshotsFolder { if ($IsLinux) { - $Path = "$HOME/Pictures" - 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" } + $path = "~/Pictures" + 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" } } else { - $Path = [Environment]::GetFolderPath('MyPictures') - 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" } + $path = [Environment]::GetFolderPath('MyPictures') + 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" } } - return $Path + return $path } try { - $Path = GetScreenshotsFolder - Set-Location "$Path" - "📂$Path" + $path = GetScreenshotsFolder + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 -} \ No newline at end of file +} diff --git a/scripts/cd-temp.ps1 b/scripts/cd-temp.ps1 index 5aa0a548..6403c761 100755 --- a/scripts/cd-temp.ps1 +++ b/scripts/cd-temp.ps1 @@ -20,10 +20,10 @@ function GetTempDir { } try { - $Path = GetTempDir - if (-not(Test-Path "$Path" -pathType container)) { throw "Temporary folder at 📂$Path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + $path = GetTempDir + if (-not(Test-Path "$path" -pathType container)) { throw "Temporary folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-templates.ps1 b/scripts/cd-templates.ps1 index 8808c286..8988b56a 100755 --- a/scripts/cd-templates.ps1 +++ b/scripts/cd-templates.ps1 @@ -14,13 +14,13 @@ try { if ($IsLinux) { - $Path = Resolve-Path "~/Templates" + $path = Resolve-Path "~/Templates" } 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)" } - Set-Location "$Path" - "📂$Path" + if (-not(Test-Path "$path" -pathType container)) { throw "Templates folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-trash.ps1 b/scripts/cd-trash.ps1 index 1837b8d7..fa32e4a4 100755 --- a/scripts/cd-trash.ps1 +++ b/scripts/cd-trash.ps1 @@ -20,7 +20,7 @@ function GetCurrentUserSID { [CmdletBinding()] param() try { if ($IsLinux) { - $path = "$HOME/.local/share/Trash/" + $path = "~/.local/share/Trash/" } else { $path = "C:\`$Recycle.Bin\$(GetCurrentUserSID)" } diff --git a/scripts/cd-up.ps1 b/scripts/cd-up.ps1 index c351a038..62752822 100755 --- a/scripts/cd-up.ps1 +++ b/scripts/cd-up.ps1 @@ -13,10 +13,10 @@ #> try { - $Path = Resolve-Path ".." - if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + $path = Resolve-Path ".." + if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-up2.ps1 b/scripts/cd-up2.ps1 index f3d19943..77a9f4bb 100755 --- a/scripts/cd-up2.ps1 +++ b/scripts/cd-up2.ps1 @@ -13,10 +13,10 @@ #> try { - $Path = Resolve-Path "../.." - if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + $path = Resolve-Path "../.." + if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-up3.ps1 b/scripts/cd-up3.ps1 index 10f79e0e..9dabb01c 100755 --- a/scripts/cd-up3.ps1 +++ b/scripts/cd-up3.ps1 @@ -13,10 +13,10 @@ #> try { - $Path = Resolve-Path "../../.." - if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + $path = Resolve-Path "../../.." + if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-up4.ps1 b/scripts/cd-up4.ps1 index aef9e8d0..81c658bc 100755 --- a/scripts/cd-up4.ps1 +++ b/scripts/cd-up4.ps1 @@ -13,10 +13,10 @@ #> try { - $Path = Resolve-Path "../../../.." - if (-not(Test-Path "$Path" -pathType container)) { throw "Folder at 📂$Path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + $path = Resolve-Path "../../../.." + if (-not(Test-Path "$path" -pathType container)) { throw "Folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-users.ps1 b/scripts/cd-users.ps1 index b052e31b..338fb9ee 100755 --- a/scripts/cd-users.ps1 +++ b/scripts/cd-users.ps1 @@ -13,10 +13,10 @@ #> try { - $Path = Resolve-Path "$HOME/.." - if (-not(Test-Path "$Path" -pathType container)) { throw "Users directory at 📂$Path doesn't exist (yet)" } - Set-Location "$Path" - "📂$Path" + $path = Resolve-Path "~/.." + if (-not(Test-Path "$path" -pathType container)) { throw "Users directory at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-videos.ps1 b/scripts/cd-videos.ps1 index 1ff06ac4..8cf4db75 100755 --- a/scripts/cd-videos.ps1 +++ b/scripts/cd-videos.ps1 @@ -14,13 +14,13 @@ try { if ($IsLinux) { - $Path = Resolve-Path "$HOME/Videos" + $path = Resolve-Path "~/Videos" } 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)" } - Set-Location "$Path" - "📂$Path" + if (-not(Test-Path "$path" -pathType container)) { throw "Videos folder at 📂$path doesn't exist (yet)" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/cd-windows.ps1 b/scripts/cd-windows.ps1 index ee125451..8f6cfe96 100755 --- a/scripts/cd-windows.ps1 +++ b/scripts/cd-windows.ps1 @@ -13,10 +13,10 @@ #> try { - $Path = Resolve-Path "$env:WINDIR" - if (-not(Test-Path "$Path" -pathType container)) { throw "Windows directory at 📂$Path doesn't exist" } - Set-Location "$Path" - "📂$Path" + $path = Resolve-Path "$env:WINDIR" + if (-not(Test-Path "$path" -pathType container)) { throw "Windows directory at 📂$path doesn't exist" } + Set-Location "$path" + "📂$path" exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"