Skip to content

Conversation

marcotaranta
Copy link

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

…n a wrong path because of the way CommandLineToArgvW do its parse.
@marcotaranta marcotaranta marked this pull request as draft October 13, 2025 13:50
@marcotaranta marcotaranta marked this pull request as ready for review October 14, 2025 22:00
@DHowett
Copy link
Member

DHowett commented Oct 15, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DHowett
Copy link
Member

DHowett commented Oct 15, 2025

Let's give the CI a spin! We are fairly sure we have tests covering some of this stuff, so it'll be nice to see what happens here.

I'm worried that this fixes a symptom without fixing the underlying problem. The quote being escaped is problem one, yes, but then the directory is not terminated (in a case like this:)

wt -d "C:\" -p PowerShell

Now, is the directory C:\" -p PowerShell? It shouldn't be, but... is it before or after your fix? 🙂

This is part of why we haven't endeavored to fix this issue yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wt.exe startingDirectory argument fails with path containing spaces and a trailing backslash

2 participants