Create a temporary folder in powershell
anonit Jan 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- while (!($TempDirectoryValid) -and ($AttemptCount -lt 5))
- # Set random directory to the users temp directory plus a random number
- # if the temporary path already exists / exit with error
- if (!(Test-Path -path $TemporaryLocation))
- # Create the temporary location
- new-item $TemporaryLocation -type directory
- if ($AttemptCount -gt 4)
- write-error "Temp folder creation attempted 5 times, failed"
RAW Paste Data