[PR #19419] Fixing issue with command line parameter --startingDirectory #31835

Open
opened 2026-01-31 09:49:52 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/19419

State: closed
Merged: No


Summary of the Pull Request

Fixing issue with command line parameter --startingDirectory ending in a wrong path because of the way CommandLineToArgvW do its parse.

References and Relevant Issues

https://devblogs.microsoft.com/oldnewthing/20100917-00/?p=12833

Detailed Description of the Pull Request / Additional comments

In this command line example: --startingDirectory "C:\Users\My User\" the CommandLineToArgvW method parses the path excluding the opening quote and maintaining the ending quote, because it is backed by a trailing slash.
I've done a very specific fix to only fix that usage of that parameter, so it doesn't end in any regression.

Validation Steps Performed

Used to fail setting the starting directory (note the trailing backslash):
wt.exe --startingDirectory "c:\A\B B\"

Successfully sets the starting directory:
wt.exe --startingDirectory "c:\A\B B"

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/19419 **State:** closed **Merged:** No --- ## Summary of the Pull Request Fixing issue with command line parameter --startingDirectory ending in a wrong path because of the way CommandLineToArgvW do its parse. ## References and Relevant Issues https://devblogs.microsoft.com/oldnewthing/20100917-00/?p=12833 ## Detailed Description of the Pull Request / Additional comments In this command line example: `--startingDirectory "C:\Users\My User\"` the CommandLineToArgvW method parses the path excluding the opening quote and maintaining the ending quote, because it is backed by a trailing slash. I've done a very specific fix to only fix that usage of that parameter, so it doesn't end in any regression. ## Validation Steps Performed Used to fail setting the starting directory (note the trailing backslash): `wt.exe --startingDirectory "c:\A\B B\"` Successfully sets the starting directory: `wt.exe --startingDirectory "c:\A\B B"` ## PR Checklist - [X] Closes #19362 - [X] Tests added/passed - [ ] Documentation updated - If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx - [ ] Schema updated (if necessary)
claunia added the pull-request label 2026-01-31 09:49:52 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31835