Skip to content

Instantly share code, notes, and snippets.



Created Feb 15, 2020
What would you like to do?
I've wanted mktemp in powershell forever, so... fine.
function mktemp {
param (
$randomfile = [System.IO.Path]::GetRandomFileName()
if ($Extension) {
$randomfile = [System.IO.Path]::ChangeExtension($randomfile, $Extension)
return Microsoft.PowerShell.Management\Join-Path ([System.IO.Path]::GetTempPath()) "$randomfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment