mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-20 08:58:18 +02:00
Improve the scripts
This commit is contained in:
parent
2030dc3820
commit
76e6cc1118
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX go-downloads.ps1
|
.SYNTAX go-downloads.ps1
|
||||||
.DESCRIPTION go to the user's downloads folder
|
.DESCRIPTION go to the user's downloads folder
|
||||||
@ -7,7 +7,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
set-location $HOME/Downloads/
|
$TargetDir = resolve-path "$HOME/Downloads/"
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂 $TargetDir"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX go-home.ps1
|
.SYNTAX go-home.ps1
|
||||||
.DESCRIPTION go to the user's home folder
|
.DESCRIPTION go to the user's home folder
|
||||||
@ -7,7 +7,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
set-location $HOME
|
$TargetDir = resolve-path "$HOME/"
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂 $TargetDir"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX go-music.ps1
|
.SYNTAX go-music.ps1
|
||||||
.DESCRIPTION go to the user's music folder
|
.DESCRIPTION go to the user's music folder
|
||||||
@ -7,7 +7,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
set-location $HOME/Music/
|
$TargetDir = resolve-path "$HOME/Music/"
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂 $TargetDir"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX go-repos.ps1
|
.SYNTAX go-repos.ps1
|
||||||
.DESCRIPTION go to the user's Git repositories folder
|
.DESCRIPTION go to the user's Git repositories folder
|
||||||
@ -7,7 +7,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
set-location $HOME/Repos/
|
$TargetDir = resolve-path "$HOME/Repos/"
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂 $TargetDir"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX go-root.ps1
|
.SYNTAX go-root.ps1
|
||||||
.DESCRIPTION go to the root directory (C: on Windows)
|
.DESCRIPTION go to the root directory (C: on Windows)
|
||||||
@ -8,10 +8,12 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
set-location /
|
$TargetDir = resolve-path "/"
|
||||||
} else {
|
} else {
|
||||||
set-location C:
|
$TargetDir = resolve-path "C:/"
|
||||||
}
|
}
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂 $TargetDir"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX go-scripts.ps1
|
.SYNTAX go-scripts.ps1
|
||||||
.DESCRIPTION go to the PowerShell Scripts folder
|
.DESCRIPTION go to the PowerShell Scripts folder
|
||||||
@ -7,7 +7,9 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
set-location $PSScriptRoot
|
$TargetDir = resolve-path "$PSScriptRoot/"
|
||||||
|
set-location "$TargetDir"
|
||||||
|
"📂 $TargetDir"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user