mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 05:26:47 +01:00
Merge branch 'master' of github.com:fleschutz/PowerShell
This commit is contained in:
commit
afde886e6f
@ -2,10 +2,9 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets the working directory to the root directory
|
Sets the working directory to the root directory
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script changes the 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
|
||||||
@ -13,14 +12,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) { $Path = "/" } else { $Path = "C:\" }
|
||||||
$Path = resolve-path "/"
|
|
||||||
} else {
|
|
||||||
$Path = resolve-path "C:\"
|
|
||||||
}
|
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
|
||||||
throw "Root directory at 📂$Path doesn't exist (yet)"
|
|
||||||
}
|
|
||||||
set-location "$Path"
|
set-location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user