Skip to content

How wt.exe process the command line arguments with double quotes? #9313

Description

@lrtfm

I would like to add an "open with vim in wsl" item for files when right-clicking it. Sometimes, the file path or name would have space, so I must enclose the parameter with double-quotes. After trying many many times, I found the command

wt nt wsl -d Ubuntu-20.04 -e bash --login -c -v "vim \"""$(wslpath 'D:\Source Insight 4.0\test.txt')"""""""

which gives me the correct behavior. As you can see there is a space in the path D:\Source Insight 4.0\test.txt.

I was wondering why I must put \""" in before $( to give a " in the bash command while I should put multiple " after ) to get a ".

Could someone give me an explanation?

The windows terminal version is 1.5.10411.0
The cmd version is

Microsoft Windows [版本 10.0.19042.804]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions