Improve the scripts

This commit is contained in:
Markus Fleschutz 2021-04-17 17:47:15 +02:00
parent 2030dc3820
commit 76e6cc1118
6 changed files with 25 additions and 13 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX go-downloads.ps1
.DESCRIPTION go to the user's downloads folder
@ -7,7 +7,9 @@
#>
try {
set-location $HOME/Downloads/
$TargetDir = resolve-path "$HOME/Downloads/"
set-location "$TargetDir"
"📂 $TargetDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX go-home.ps1
.DESCRIPTION go to the user's home folder
@ -7,7 +7,9 @@
#>
try {
set-location $HOME
$TargetDir = resolve-path "$HOME/"
set-location "$TargetDir"
"📂 $TargetDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX go-music.ps1
.DESCRIPTION go to the user's music folder
@ -7,7 +7,9 @@
#>
try {
set-location $HOME/Music/
$TargetDir = resolve-path "$HOME/Music/"
set-location "$TargetDir"
"📂 $TargetDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX go-repos.ps1
.DESCRIPTION go to the user's Git repositories folder
@ -7,7 +7,9 @@
#>
try {
set-location $HOME/Repos/
$TargetDir = resolve-path "$HOME/Repos/"
set-location "$TargetDir"
"📂 $TargetDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX go-root.ps1
.DESCRIPTION go to the root directory (C: on Windows)
@ -8,10 +8,12 @@
try {
if ($IsLinux) {
set-location /
$TargetDir = resolve-path "/"
} else {
set-location C:
$TargetDir = resolve-path "C:/"
}
set-location "$TargetDir"
"📂 $TargetDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX go-scripts.ps1
.DESCRIPTION go to the PowerShell Scripts folder
@ -7,7 +7,9 @@
#>
try {
set-location $PSScriptRoot
$TargetDir = resolve-path "$PSScriptRoot/"
set-location "$TargetDir"
"📂 $TargetDir"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"