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-Item cannot create symlink/hardlink for file with name containing bracket #25744

Copy link
Copy link
@wumo

Description

@wumo
Issue body actions

Prerequisites

Steps to reproduce

As for latest 7.5.2, the following error happened:

> Test-Path -LiteralPath "a\a[b].txt"
# return True
> New-Item -ItemType SymbolicLink -Path "a[b].txt" -Target "a\a[b].txt"
# New-Item: Cannot find path 'a\a[b].txt' because it does not exist.

Expected behavior

PS> New-Item -ItemType SymbolicLink -Path "a[b].txt" -Target "a\a[b].txt"

 Directory: E:\test

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
la---           7/10/2025    02:24              0 a[b].txt -> a\a[b].txt

Actual behavior

PS> New-Item -ItemType SymbolicLink -Path "a[b].txt" -Target "a\a[b].txt"

New-Item: Cannot find path 'a\a[b].txt' because it does not exist.

Error details

Environment data

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    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.