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

Open
opened 2026-01-31 03:24:22 +00:00 by claunia · 0 comments
Owner

Originally created by @lrtfm on GitHub (Mar 1, 2021).

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]
Originally created by @lrtfm on GitHub (Mar 1, 2021). 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] ``` <!-- ``` ❯ [Environment]::OSVersion Platform ServicePack Version VersionString -------- ----------- ------- ------------- Win32NT 10.0.19042.0 Microsoft Windows NT 10.0.19042.0 ``` -->
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 03:24:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#12765