Created
June 27, 2017 05:34
-
-
Save stanislavhordiyenko/351dca11b881b5394475ad5f10640bf6 to your computer and use it in GitHub Desktop.
Create Temporary Files in PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create temporary file with PowerShell 4 or lower | |
$TempFile = [System.IO.Path]::GetTempFileName() | |
Write-Output "Temporary file has been created. It is located here: $($TempFile)" | |
Remove-Item $TempFile -Force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create temporary file with PowerShell 5 | |
$TempFile = New-TemporaryFile | |
Write-Output "Temporary file has been created. It is located here: $($TempFile)" | |
Remove-Item $TempFile.FullName -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment