Drag & drop in WSL should use single quotes #20180

Closed
opened 2026-01-31 07:05:51 +00:00 by claunia · 4 comments
Owner

Originally created by @MikeWang000000 on GitHub (Jul 2, 2023).

Windows Terminal version

1.17.11461.0

Windows build number

10.0.22621.1928

Other Software

GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu) (inside WSL)

Steps to reproduce

File drag & drop in WSL Bash:

user@localhost~$ cat /mnt/c/Users/Admin/Desktop/$hello.txt
cat: /mnt/c/Users/Admin/Desktop/.txt: No such file or directory
user@localhost~$ cat "/mnt/c/Users/Admin/Desktop/$hello world.txt"
cat: '/mnt/c/Users/Admin/Desktop/ world.txt': No such file or directory

It does not work because $hello is recognized as a variable.

Expected Behavior

user@localhost~$ cat '/mnt/c/Users/Admin/Desktop/$hello.txt'
user@localhost~$ cat '/mnt/c/Users/Admin/Desktop/$hello world.txt'

or

user@localhost~$ cat /mnt/c/Users/Admin/Desktop/\$hello.txt
user@localhost~$ cat /mnt/c/Users/Admin/Desktop/\$hello\ world.txt

Actual Behavior

user@localhost~$ cat /mnt/c/Users/Admin/Desktop/$hello.txt
cat: /mnt/c/Users/Admin/Desktop/.txt: No such file or directory
user@localhost~$ cat "/mnt/c/Users/Admin/Desktop/$hello world.txt"
cat: '/mnt/c/Users/Admin/Desktop/ world.txt': No such file or directory

:/

Originally created by @MikeWang000000 on GitHub (Jul 2, 2023). ### Windows Terminal version 1.17.11461.0 ### Windows build number 10.0.22621.1928 ### Other Software GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu) (inside WSL) ### Steps to reproduce File drag & drop in WSL Bash: ```console user@localhost~$ cat /mnt/c/Users/Admin/Desktop/$hello.txt cat: /mnt/c/Users/Admin/Desktop/.txt: No such file or directory user@localhost~$ cat "/mnt/c/Users/Admin/Desktop/$hello world.txt" cat: '/mnt/c/Users/Admin/Desktop/ world.txt': No such file or directory ``` It does not work because `$hello` is recognized as a variable. ### Expected Behavior ```console user@localhost~$ cat '/mnt/c/Users/Admin/Desktop/$hello.txt' user@localhost~$ cat '/mnt/c/Users/Admin/Desktop/$hello world.txt' ``` or ```console user@localhost~$ cat /mnt/c/Users/Admin/Desktop/\$hello.txt user@localhost~$ cat /mnt/c/Users/Admin/Desktop/\$hello\ world.txt ``` ### Actual Behavior ```console user@localhost~$ cat /mnt/c/Users/Admin/Desktop/$hello.txt cat: /mnt/c/Users/Admin/Desktop/.txt: No such file or directory user@localhost~$ cat "/mnt/c/Users/Admin/Desktop/$hello world.txt" cat: '/mnt/c/Users/Admin/Desktop/ world.txt': No such file or directory ``` :/
Author
Owner

@lhecker commented on GitHub (Jul 5, 2023):

Note

Walkthrough

FYI the code that does it is here: 167819a8f4/src/cascadia/TerminalControl/TermControl.cpp (L2800-L2804)

The best course of action would be to use single quotes for WSL only, because cmd.exe doesn't get single quotes.

@lhecker commented on GitHub (Jul 5, 2023): > **Note** > ## Walkthrough FYI the code that does it is here: https://github.com/microsoft/terminal/blob/167819a8f407aac691da79e061af85a066ffcbc5/src/cascadia/TerminalControl/TermControl.cpp#L2800-L2804 The best course of action would be to use single quotes for WSL only, because cmd.exe doesn't get single quotes.
Author
Owner

@zadjii-msft commented on GitHub (Jul 12, 2023):

also x-ref #8109

@zadjii-msft commented on GitHub (Jul 12, 2023): also x-ref #8109
Author
Owner

@Darkace01 commented on GitHub (Aug 3, 2023):

Can someone help explain how I can locate the code that handles drag and drop for the terminal?

@Darkace01 commented on GitHub (Aug 3, 2023): Can someone help explain how I can locate the code that handles drag and drop for the terminal?
Author
Owner

@lhecker commented on GitHub (Aug 3, 2023):

@Darkace01 I've linked the code the code that handles this in my comment above: https://github.com/microsoft/terminal/issues/15646#issuecomment-1622565414
If you set a breakpoint there, you should quickly find the call stack of a drag & drop.

@lhecker commented on GitHub (Aug 3, 2023): @Darkace01 I've linked the code the code that handles this in my comment above: https://github.com/microsoft/terminal/issues/15646#issuecomment-1622565414 If you set a breakpoint there, you should quickly find the call stack of a drag & drop.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20180