Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explorer.exe /select,'C:\Path With Spaces' does not work, but works with no /select switch #7603

Closed
2 tasks done
damonlynch opened this issue Oct 27, 2021 · 2 comments
Closed
2 tasks done

Comments

@damonlynch
Copy link

Version

Microsoft Windows [Version 10.0.22000.282]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

This works on WSL 1 (tested on Microsoft Windows [Version 10.0.19043.1288]) and WSL 2:

explorer.exe /select,'C:\some\path'

It works because there are no spaces in the path. When spaces are introduced, e.g.

explorer.exe /select,'C:\Program Files\Common Files'

explorer fails to open the correct path and select the child folder. Removing the /select, command line switch does open explorer displaying the correct folder's contents even when the path has spaces, however:

explorer.exe 'C:\Program Files\Common Files'

These behaviors occur in both WSL 1 and WSL 2.

Expected Behavior

I expect the Explorer /select, command line switch to work irrespective of whether the path has spaces in it.

Actual Behavior

Windows Explorer opens, but it does not open the specified path and select the child folder as instructed — instead it displays a default folder (D:\Documents in my case).

Possibly related issue: #2835

Diagnostic Logs

No response

@willeccles
Copy link

This is not related to WSL. This behavior occurs in command prompt as well. This is because CMD argument parsing is extremely convoluted, but the long story short is that if you replace the single quotes '' with double quotes "", it should work just fine.

@ebarzilay-godaddy
Copy link

In case anyone runs into this: to make it work, separate the path into its own argument:

explorer.exe /select, 'C:\Program Files\Common Files'

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

No branches or pull requests

3 participants