Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugWG-Cmdletsgeneral cmdlet issuesWaiting - DotNetCorewaiting on a fix/change in .NET
Milestone
Description
Now, New-TemporaryFile cmdlet creates path to a temporary file. Sometimes we want to have path to a temporary directory.
Proposal is to add a Directory switch to get path to new temporary directory.
Reacted by Michael Klement, Jimmy Sallenback, Tatsunori Uchino and Christopher Ursich
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugWG-Cmdletsgeneral cmdlet issuesWaiting - DotNetCorewaiting on a fix/change in .NET
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