Five Years Later, same-issue-ai Still Fooled Everyone — This Is Not a Duplicate, the Problem Remains: The Square Brackets Nightmare in Paths #23846

Closed
opened 2026-01-31 08:54:11 +00:00 by claunia · 5 comments
Owner

Originally created by @cnrat on GitHub (Nov 27, 2025).

Windows Terminal version

1.23.12811.0

Windows build number

10.0.22631.6199

Other Software

No response

Steps to reproduce

  1. Create a directory that contains square brackets ([ or ]) in its name.
  2. Open cmd.exe and use cd /d to navigate into this directory.
  3. If you try to launch wt.exe from this path, the current directory in Windows Terminal defaults to your user home directory instead of the target path.
  4. If you try to launch powershell.exe from this path, the current directory is set to C:\Windows\System32\WindowsPowerShell\v1.0
  5. wt -d has the same issue
  6. The latest Powershell do solve this issue a bit, Set-Location works but cd /d still broken, -literalPath is not supported by wt.exe

Expected Behavior

The user should be able to launch wt.exe or powershell.exe normally from a path that contains square brackets ([ or ]) without the current directory being reset.

Actual Behavior

Both wt.exe and powershell.exe still fail to handle paths containing square brackets correctly.
PowerShell partially mitigates the issue by fixing Set-Location and using the -LiteralPath parameter, but the problem persists.


This is a violation of design principles. When introducing exciting new features in PowerShell, we must ensure backward compatibility.
Applying one workaround after another to mask a fundamental design flaw, as is happening now, is not acceptable.

Originally created by @cnrat on GitHub (Nov 27, 2025). ### Windows Terminal version 1.23.12811.0 ### Windows build number 10.0.22631.6199 ### Other Software _No response_ ### Steps to reproduce 1. Create a directory that contains square brackets (`[` or `]`) in its name. 2. Open `cmd.exe` and use `cd /d` to navigate into this directory. 3. If you try to launch `wt.exe` from this path, the current directory in Windows Terminal defaults to your user home directory instead of the target path. 4. If you try to launch `powershell.exe` from this path, the current directory is set to `C:\Windows\System32\WindowsPowerShell\v1.0` 5. `wt -d` has the same issue 6. The latest Powershell do solve this issue a bit, `Set-Location` works but `cd /d` still broken, `-literalPath` is not supported by `wt.exe` ### Expected Behavior The user should be able to launch `wt.exe` or `powershell.exe` normally from a path that contains square brackets (`[` or `]`) without the current directory being reset. ### Actual Behavior Both `wt.exe` and `powershell.exe` still fail to handle paths containing square brackets correctly. `PowerShell` partially mitigates the issue by fixing `Set-Location` and using the `-LiteralPath` parameter, but the problem persists. --- This is a violation of design principles. When introducing exciting new features in PowerShell, we must ensure backward compatibility. Applying one workaround after another to mask a fundamental design flaw, as is happening now, is not acceptable.
claunia added the Needs-TriageIssue-BugResolution-ExternalNeeds-Attention labels 2026-01-31 08:54:12 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Nov 29, 2025):

Buddy PowerShell 5 is like, many many years old at this point. Does this repro with PowerShell 7/?

@zadjii-msft commented on GitHub (Nov 29, 2025): Buddy PowerShell 5 is like, many many years old at this point. Does this repro with PowerShell 7/?
Author
Owner

@cnrat commented on GitHub (Nov 29, 2025):

Buddy PowerShell 5 is like, many many years old at this point. Does this repro with PowerShell 7/?

If you’ve noticed, Windows 11 also includes PowerShell 5 instead of PowerShell 7+. As for your issue, I reproduced the behavior, and with the same steps the results are as follows:

  1. I manually set the default profile in Windows Terminal to PowerShell (replacing the original Windows PowerShell);

  2. Then, when entering wt.exe in a path containing square brackets, the shell that actually launches is PowerShell 7.5.4, but the working directory is still reset to the user’s home directory;

  3. In the same path, entering powershell.exe launches PowerShell 5, and the working directory is reset to C:\Windows\System32\WindowsPowerShell\v1.0>;

  4. In the same path, entering pwsh.exe launches PowerShell 7.5.4, and the working directory works correctly.

@cnrat commented on GitHub (Nov 29, 2025): > Buddy PowerShell 5 is like, many many years old at this point. Does this repro with PowerShell 7/? If you’ve noticed, Windows 11 also includes PowerShell 5 instead of PowerShell 7+. As for your issue, I reproduced the behavior, and with the same steps the results are as follows: 1. I manually set the default profile in Windows Terminal to **PowerShell** (replacing the original **Windows PowerShell**); 2. Then, when entering `wt.exe` in a path containing square brackets, the shell that actually launches is PowerShell 7.5.4, but the working directory is **still reset to the user’s home directory**; 3. In the same path, entering `powershell.exe` launches PowerShell 5, and the working directory is reset to C:\Windows\System32\WindowsPowerShell\v1.0>; 4. In the same path, entering `pwsh.exe` launches PowerShell 7.5.4, and the working directory **works correctly**.
Author
Owner

@DHowett commented on GitHub (Dec 1, 2025):

I'm sorry that we can't fix bugs in software this team does not have control over. Unfortunately, such is the case with PowerShell.

@DHowett commented on GitHub (Dec 1, 2025): I'm sorry that we can't fix bugs in software this team does not have control over. Unfortunately, such is the case with PowerShell.
Author
Owner

@cnrat commented on GitHub (Dec 1, 2025):

I'm sorry that we can't fix bugs in software this team does not have control over. Unfortunately, such is the case with PowerShell.

Under the single-variable principle, pwsh.exe and wt.exe are launched:

  1. from the same parent process,

  2. in the same directory containing square brackets,

  3. on the same OS,

  4. running the same PowerShell 7.5.4.

The only variable that changes is the executable: pwsh.exe vs wt.exe.

Since pwsh.exe preserves the working directory correctly while wt.exe does NOT, the differing behaviour must at least partially come from wt.exe’s own startup logic.

Therefore the issue cannot be classified as purely external.
Even if external components contribute, Windows Terminal is still one of the affected components and participates in producing the incorrect behaviour.

I apologize that I wasn’t able to pre-package a pull request and spoon-feed it to you as well.
I assumed that demonstrating the single-variable discrepancy would be sufficient for a proper triage.

@cnrat commented on GitHub (Dec 1, 2025): > I'm sorry that we can't fix bugs in software this team does not have control over. Unfortunately, such is the case with PowerShell. Under the single-variable principle, pwsh.exe and wt.exe are launched: 1. from the same parent process, 2. in the same directory containing square brackets, 3. on the same OS, 4. running the same PowerShell 7.5.4. The only variable that changes is the executable: **pwsh.exe** vs **wt.exe**. Since `pwsh.exe` preserves the working directory correctly while `wt.exe` does **NOT**, the differing behaviour must at least partially come from `wt.exe`’s own startup logic. Therefore the issue cannot be classified as purely **external**. Even if external components contribute, Windows Terminal is still one of the affected components and participates in producing the incorrect behaviour. I apologize that I wasn’t able to pre-package a pull request and spoon-feed it to you as well. I assumed that demonstrating the single-variable discrepancy would be sufficient for a proper triage.
Author
Owner

@DHowett commented on GitHub (Dec 1, 2025):

Then, when entering wt.exe in a path containing square brackets, the shell that actually launches is PowerShell 7.5.4, but the working directory is still reset to the user’s home directory;

Launching an entirely new shell in an instance of Terminal has never inherited the parent process's working directory.

If you want that behavior, read up on how the starting directory setting is handled.

spoon-feed it to you as well

Cut it out.

@DHowett commented on GitHub (Dec 1, 2025): > Then, when entering wt.exe in a path containing square brackets, the shell that actually launches is PowerShell 7.5.4, but the working directory is still reset to the user’s home directory; Launching an entirely new shell in an instance of Terminal has never inherited the parent process's working directory. If you want that behavior, read up on [how the starting directory setting is handled](https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-general#starting-directory). > spoon-feed it to you as well Cut it out.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23846