You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the name would become (eg) New-TemporaryItem. Or perhaps add a -Temporary switch to the existing New-Item and let the provider figure out what that means.
Reacted by Michael Klement, Adam Driscoll, Laurent Dardenne and Peter Daniels
I can agree that New-Item -Temporary would work, it is not quite as obvious as New-TemporaryFile, New-TemporaryDirectory, or even New-TemporaryItem.
Adding this to New-Item should allow for temporary files and directories to be created on a -Path other than the platform "temp" directory. If -Path is not specified, the provider should know the platform "temp" directory.
The .Net team has now created a new tracking issue as they are now committed to implementing various improvements to the temp file APIs that will cover this. We can expect this to be available in .net 5 dotnet/runtime#2048
Activity
wisemoth commentedon Mar 28, 2017
I've also needed this.
I think the name would become (eg)
New-TemporaryItem. Or perhaps add a-Temporaryswitch to the existingNew-Itemand let the provider figure out what that means.Liturgist commentedon Jul 27, 2017
I can agree that
New-Item -Temporarywould work, it is not quite as obvious asNew-TemporaryFile,New-TemporaryDirectory, or evenNew-TemporaryItem.Adding this to
New-Itemshould allow for temporary files and directories to be created on a-Pathother than the platform "temp" directory. If-Pathis not specified, the provider should know the platform "temp" directory.bergmeister commentedon Mar 7, 2018
Ilya (@iSazonov) Should we mark this as blocked due to https://github.com/dotnet/corefx/issues/24001 as welll?
bergmeister commentedon Jan 23, 2020
The .Net team has now created a new tracking issue as they are now committed to implementing various improvements to the temp file APIs that will cover this. We can expect this to be available in .net 5
dotnet/runtime#2048
anonhostpi commentedon Jul 14, 2025
Offloading this to dotnet does not resolve the problem for Constrained Language Mode or Restricted Language Mode