terminal: Cannot use spaces encapsulated in double quotes on settings.json (even escaped)

Windows Terminal version (or Windows build number)

10.0.18363.0

Other Software

cmd.exe

Steps to reproduce

On settings.json use the following:

"commandline": "powershell.exe Start-Process cmd.exe '/c wt.exe -p \"Windows PowerShell\"' -verb runAs",

Double quotes is required since the name has an space character.

settings.json.txt

Expected Behavior

If you ran the same on powershell or cmd directly, you can get the expected result which is open the Windows Terminal with a Desired Profile:

PowerShell

Start-Process cmd.exe '/c wt.exe -p "Windows PowerShell"' -verb runAs

Command Prompt

powershell.exe Start-Process cmd.exe '/c wt.exe -p \"Windows PowerShell\"' -verb runAs```

image

Actual Behavior

This configuration is not being taken, instead opens the default profile.

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (3 by maintainers)

Most upvoted comments

came here via the email (presumably) you sent out from the other long, locked thread, and using the guid for the profile solved it!! i get a new window that is properly elevated and colored and is in powershell and not bash and everything. excellent work, thank you so much

I’m sure someone with more time than me could figure it out.

That means that all the team will not be able to resolve this? the case is closed, and should be open.

At the end of the day though, looks like what you’re looking for is #632 😉

Yes and no, I don’t have issues with the escalation privileges persé, I have issues with the quoting and because of that I believe that this case should remain open.

I’m gonna close this for now since you’ve seemed to figure it out for yourself, though if anyone else finds the right way to escape the commandlines here, feel free to share it!

A workaround does not mean that is a permanent solution, the quoting issue is still present.