Add go-root.ps1

This commit is contained in:
Markus Fleschutz 2021-03-15 08:00:38 +01:00
parent 01df13393a
commit 8b608c57a2
3 changed files with 21 additions and 0 deletions

View File

@ -34,6 +34,7 @@ generate-qrcode.ps1, generates a QR code
go-downloads.ps1, go to the user's downloads folder go-downloads.ps1, go to the user's downloads folder
go-home.ps1, go to the user's home folder go-home.ps1, go to the user's home folder
go-music.ps1, go to the user's music folder go-music.ps1, go to the user's music folder
go-root.ps1, go to the root directory (C: on Windows)
go-scripts.ps1, go to the PowerShell Scripts folder go-scripts.ps1, go to the PowerShell Scripts folder
hibernate.ps1, enables hibernate mode for the local computer (requires admin rights) hibernate.ps1, enables hibernate mode for the local computer (requires admin rights)
inspect-exe.ps1, prints basic information of the given executable file inspect-exe.ps1, prints basic information of the given executable file

1 Script Description
34 go-downloads.ps1 go to the user's downloads folder
35 go-home.ps1 go to the user's home folder
36 go-music.ps1 go to the user's music folder
37 go-root.ps1 go to the root directory (C: on Windows)
38 go-scripts.ps1 go to the PowerShell Scripts folder
39 hibernate.ps1 enables hibernate mode for the local computer (requires admin rights)
40 inspect-exe.ps1 prints basic information of the given executable file

View File

@ -78,6 +78,7 @@ Collection of PowerShell Scripts
* [go-downloads.ps1](Scripts/go-downloads.ps1) - go to the user's downloads folder * [go-downloads.ps1](Scripts/go-downloads.ps1) - go to the user's downloads folder
* [go-home.ps1](Scripts/go-home.ps1) - go to the user's home folder * [go-home.ps1](Scripts/go-home.ps1) - go to the user's home folder
* [go-music.ps1](Scripts/go-music.ps1) - go to the user's music folder * [go-music.ps1](Scripts/go-music.ps1) - go to the user's music folder
* [go-root.ps1](Scripts/go-root.ps1) - go to the root directory (C: on Windows)
* [go-scripts.ps1](Scripts/go-scripts.ps1) - go to the PowerShell Scripts folder * [go-scripts.ps1](Scripts/go-scripts.ps1) - go to the PowerShell Scripts folder
* [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file * [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree * [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree

19
Scripts/go-root.ps1 Executable file
View File

@ -0,0 +1,19 @@
#!/bin/powershell
<#
.SYNTAX ./go-root.ps1
.DESCRIPTION go to the root directory (C: on Windows)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
try {
if ($IsLinux) {
set-location /
} else {
set-location C:
}
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}