Skip to content

New-TemporaryDirectory or New-TemporaryItem or New-Item -Temporary #25754

Closed

Description

Summary of the new feature / enhancement

Currently, there is only one option for creating temporary items without relying on [System.IO] calls and that is New-TemporaryFile.

Since users subjected to Constrained (CLM) or Restricted (RLM) Language Modes can not use [System.IO], if they want to create a directory, they must use:

New-TemporaryFile | % { rm $_; ni $_ -ItemType Directory }

Which seems counter-intuitive

Proposed technical implementation details (optional)

As proposed previously, a few potential solutions exist:

  • Create a new cmdlet/function called New-TemporaryDirectory that functions identically to New-TemporaryFile, but for dirs.
  • Rename New-TemporaryFile to New-TemporaryItem and add support for -ItemType Directory
  • Add a -Temporary switch to New-Item

This previous issue was closed, because it offloaded support for temporary paths to dotnet and [System.IO].

While using [System.IO] works in Full Language Mode (FLM), it does not for CLM, RLM, and NLM (No Language Mode)

Activity

  1. added
    Issue-Enhancement
    Needs-Triage
    on Jul 14, 2025
  2. added
    WG-NeedsReview
    WG-Cmdlets
    on Jul 15, 2025
  3. jdhitsolutions commented on Nov 19, 2025

    @jdhitsolutions
    Collaborator

    The WG has discussed this idea and agrees that it is a worthwhile addition. The recommended proposal is to create a cmdlet called New-TemporaryDirectory that follows the pattern of New-TemporaryFile.

  4. added
    Up-for-Grabs
    WG-Reviewed
    and removed
    Needs-Triage
    WG-NeedsReview
    on Nov 19, 2025
  5. moved this from In-Progress-Issues to Reviewed in Cmdlets Working Groupon Nov 19, 2025
  6. added a commit that references this issue on Jan 11, 2026
    cfd6cf6
  7. added 2 commits that reference this issue on Mar 22, 2026
    d8b6bef
    98fc106
  8. added
    Resolution-No Activity
    on May 30, 2026
  9. microsoft-github-policy-service commented on May 30, 2026

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.

    Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.

  10. added 2 commits that reference this issue on Aug 6, 2026
    11287d1
    5bbf722
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementResolution-No ActivityUp-for-GrabsWG-CmdletsWG-Reviewed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions