mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 09:23:12 +01:00
Update the cd-*.ps1 scripts
This commit is contained in:
parent
1803b09fad
commit
45cd3e0876
@ -5,19 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to the user's autostart folder.
|
This PowerShell script changes the working directory to the user's autostart folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-autostart
|
PS> ./cd-autostart
|
||||||
📂C:\Users\Joe\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
|
📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$HOME/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup"
|
$Path = Resolve-Path "$HOME/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 {
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
This PowerShell script changes the working directory to the user's desktop folder.
|
This PowerShell script changes the working directory to the user's desktop folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-desktop
|
PS> ./cd-desktop
|
||||||
📂/home/Joe/Desktop
|
📂/home/Markus/Desktop
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
$Path = resolve-path "$HOME/Desktop"
|
$Path = Resolve-Path "$HOME/Desktop"
|
||||||
} else {
|
} else {
|
||||||
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
$Path = [Environment]::GetFolderPath('DesktopDirectory')
|
||||||
}
|
}
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Desktop folder at 📂$Path doesn't exist (yet)"
|
throw "Desktop folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
This PowerShell script changes the working directory to the documents folder.
|
This PowerShell script changes the working directory to the documents folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-docs
|
PS> ./cd-docs
|
||||||
📂C:\Users\Joe\Documents
|
📂C:\Users\Markus\Documents
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -21,7 +21,7 @@ try {
|
|||||||
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 {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
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
|
||||||
📂C:\Users\Joe\Downloads
|
📂C:\Users\Markus\Downloads
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
This PowerShell script changes the working directory to the user's Dropbox folder.
|
This PowerShell script changes the working directory to the user's Dropbox folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-dropbox
|
PS> ./cd-dropbox
|
||||||
📂/home/Joe/Dropbox
|
📂/home/Markus/Dropbox
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -17,7 +17,7 @@ try {
|
|||||||
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 {
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to the user's home directory.
|
This PowerShell script changes the working directory to the user's home directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-home
|
PS> ./cd-home
|
||||||
📂/home/Joe
|
📂/home/Markus
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$HOME"
|
$Path = Resolve-Path "$HOME"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Home directory at 📂$Path doesn't exist (yet)"
|
throw "Home directory at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
This PowerShell script changes the working directory to the user's music folder.
|
This PowerShell script changes the working directory to the user's music folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-music
|
PS> ./cd-music
|
||||||
📂/home/Joe/Music
|
📂/home/Markus/Music
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -21,7 +21,7 @@ try {
|
|||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Music folder at 📂$Path doesn't exist (yet)"
|
throw "Music folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to the user's OneDrive folder.
|
This PowerShell script changes the working directory to the user's OneDrive folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-onedrive
|
PS> ./cd-onedrive
|
||||||
📂/home/Joe/OneDrive
|
📂/home/Markus/OneDrive
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$HOME/OneDrive"
|
$Path = Resolve-Path "$HOME/OneDrive"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "OneDrive folder at 📂$Path doesn't exist (yet)"
|
throw "OneDrive folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
This PowerShell script changes the working directory to the user's pictures folder.
|
This PowerShell script changes the working directory to the user's pictures folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-pics
|
PS> ./cd-pics
|
||||||
📂/home/Joe/Pictures
|
📂/home/Markus/Pictures
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function GetCurrentUserSID { [CmdletBinding()] param()
|
function GetCurrentUserSID { [CmdletBinding()] param()
|
||||||
@ -20,10 +20,10 @@ function GetCurrentUserSID { [CmdletBinding()] param()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = 'C:\$Recycle.Bin\' + "$(GetCurrentUserSID)"
|
$Path = 'C:\$Recycle.Bin\' + "$(GetCurrentUserSID)"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Recycle bin folder at 📂$Path doesn't exist (yet)"
|
throw "Recycle bin folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to the user's Git repositories folder.
|
This PowerShell script changes the working directory to the user's Git repositories folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-repos
|
PS> ./cd-repos
|
||||||
📂/home/Joe/Repos
|
📂/home/Markus/Repos
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$HOME/Repos"
|
$Path = Resolve-Path "$HOME/Repos"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Git repositories folder at 📂$Path doesn't exist (yet)"
|
throw "Git repositories folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,15 +5,16 @@
|
|||||||
This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
|
This PowerShell script changes the current working directory to the root directory (C:\ on Windows).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-root
|
PS> ./cd-root
|
||||||
|
📂C:\
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to the PowerShell scripts folder.
|
This PowerShell script changes the working directory to the PowerShell scripts folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-scripts
|
PS> ./cd-scripts
|
||||||
📂/home/Joe/PowerShell/Scripts
|
📂/home/Markus/PowerShell/Scripts
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$PSScriptRoot"
|
$Path = Resolve-Path "$PSScriptRoot"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "PowerShell scripts folder at 📂$Path doesn't exist (yet)"
|
throw "PowerShell scripts folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to the user's SSH folder.
|
This PowerShell script changes the working directory to the user's SSH folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-ssh
|
PS> ./cd-ssh
|
||||||
📂/home/Joe/.ssh
|
📂/home/Markus/.ssh
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$HOME/.ssh"
|
$Path = Resolve-Path "$HOME/.ssh"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "SSH folder at 📂$Path doesn't exist (yet)"
|
throw "SSH folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
This PowerShell script changes the working directory to the temporary folder.
|
This PowerShell script changes the working directory to the temporary folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-temp
|
PS> ./cd-temp
|
||||||
📂C:\Users\Joe\AppData\Local\Temp
|
📂C:\Users\Markus\AppData\Local\Temp
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function GetTempDir {
|
function GetTempDir {
|
||||||
|
@ -5,18 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to one directory level up.
|
This PowerShell script changes the working directory to one directory level up.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> .\cd-up
|
PS> .\cd-up
|
||||||
|
📂C:\Users
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path ".."
|
$Path = Resolve-Path ".."
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Folder at 📂$Path doesn't exist (yet)"
|
throw "Folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,18 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to two directory level up.
|
This PowerShell script changes the working directory to two directory level up.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-up2
|
PS> ./cd-up2
|
||||||
|
📂C:\
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "../.."
|
$Path = Resolve-Path "../.."
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Folder at 📂$Path doesn't exist (yet)"
|
throw "Folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,18 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to three directory levels up.
|
This PowerShell script changes the working directory to three directory levels up.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-up3
|
PS> ./cd-up3
|
||||||
|
📂C:\
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "../../.."
|
$Path = Resolve-Path "../../.."
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Folder at 📂$Path doesn't exist (yet)"
|
throw "Folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,18 +5,19 @@
|
|||||||
This PowerShell script changes the working directory to four directory levels up.
|
This PowerShell script changes the working directory to four directory levels up.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-up4
|
PS> ./cd-up4
|
||||||
|
📂C:\
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "../../../.."
|
$Path = Resolve-Path "../../../.."
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Folder at 📂$Path doesn't exist (yet)"
|
throw "Folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
This PowerShell script changes the working directory to the user's videos folder.
|
This PowerShell script changes the working directory to the user's videos folder.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./cd-videos
|
PS> ./cd-videos
|
||||||
📂/home/Joe/Videos
|
📂C:\Users\Markus\Videos
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -21,7 +21,7 @@ try {
|
|||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Videos folder at 📂$Path doesn't exist (yet)"
|
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 {
|
||||||
|
@ -9,15 +9,15 @@
|
|||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path "$env:WINDIR"
|
$Path = Resolve-Path "$env:WINDIR"
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Windows directory at 📂$Path doesn't exist"
|
throw "Windows directory at 📂$Path doesn't exist"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user