PowerShell 5 introduces the New-TemporaryFile cmdlet, which is handy. How can I do the same thing but instead of a file create a directory? Is there a New-TemporaryDirec
I also love one-liners, and I'm begging for a downvote here. All I ask is that you put my own vague negative feelings about this into words.
New-TemporaryFile | %{ rm $_; mkdir $_ }
Depending on the type of purist you are, you can do %{ mkdir $_-d }
, leaving placeholder to avoid collisions.
And it's reasonable to stand on Join-Path $env:TEMP $(New-Guid) | %{ mkdir $_ }
also.