Create a temp file in Powershell

Create a temporary file in the TMP environment variable location in powershell:

$TempFile = [System.Io.Path]::GetTempFileName()

So as an example the above will create something like this:
C:\Users\\AppData\Local\Temp\tmp3472.tmp

This $TempFile variable can then be used in a script.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.