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