Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link

Description

@anonhostpi
Issue body actions

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)

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation

    Type

    No type

    Projects

    Status
    Reviewed
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.