mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-27 04:08:44 +02:00
Fix cd-temp.ps1
This commit is contained in:
parent
3618087c25
commit
447560ef34
@ -13,16 +13,18 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
function GetTempDir {
|
function GetTempDir {
|
||||||
if ($IsLinux) { return "/tmp" }
|
if ("$env:TEMP" -ne "") { return "$env:TEMP" }
|
||||||
return "$env:TEMP"
|
if ("$env:TMP" -ne "") { return "$env:TMP" }
|
||||||
|
if ($IsLinux) { return "/tmp" }
|
||||||
|
return "C:\Temp"
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Path = resolve-path GetTempDir
|
$Path = GetTempDir
|
||||||
if (-not(test-path "$Path" -pathType container)) {
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
throw "Temporary folder at 📂$Path doesn't exist (yet)"
|
throw "Temporary folder at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
set-location "$Path"
|
Set-Location "$Path"
|
||||||
"📂$Path"
|
"📂$Path"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user