August 1st, 2014

PowerTip: Use PowerShell to Create Temporary File Name

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to create a temporary file name.

Hey, Scripting Guy! Question I need to output data to a file, but I do not need a permanent file name and location because
           the file will be later deleted. How can I easily use Windows PowerShell to create a temporary file name?

Hey, Scripting Guy! Answer Use the GetTempFileName static method from the System.IO.Path .NET Framework class:

[System.IO.Path]::GetTempFileName()

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.