Create a Temporary File Using PowerShell



To create a temporary file with the PowerShell, we can use the New-TemporaryFile command. This command creates a temporary file tmp<NNNN>.tmp where NNNN represents the random hexadecimal number.

Example

PS C:\> New-TemporaryFile

Directory: C:\Users\Administrator.AUTOMATIONLAB\AppData\Local\Temp

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        4/10/2021   9:14 PM              0 tmpF624.tmp

The output path is selected based on the path defined at Path.GetTempPath() 

https://docs.microsoft.com/

Updated on: 2021-04-12T11:10:28+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements