dotnet / dotnet/project-system
Unable to use quotes in launchSettings.json
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
## Visual Studio Version
Version 17.8.0 Preview 1.0 [33909.54.main]
## Summary
As part of the debug sequence I need to pass a variable to a script, and that variable may contain spaces, so it needs to be quoted for the script to correctly interpret the cli argument.
```json
{
"profiles": {
"Launch test VS": {
"commandName": "Executable",
"executablePath": "$(SolutionDir)\\start-debug.cmd",
"commandLineArgs": "$(ExtensionsTestVSPath)\\Common7\\IDE\\devenv.exe"
}
}
}
```
where `$(ExtensionsTestVSPath)` is expanded to `C:\Program Files\Microsoft Visual Studio\2022\PublicPreview\Common7\IDE\devenv.exe`.
```cmd
:: start-debug.cmd
@ECHO OFF
:: Chane to the scripts directory
cd %~dp0
echo %1
pause
exit 0
```

I tried `'"$(ExtensionsTestVSPath)\\Common7\\IDE\\devenv.exe"'`, and VS didn't like it. I also tried `"\"$(ExtensionsTestVSPath)\\Common7\\IDE\\devenv.exe\""`, and VS didn't like it either.
I tried silly things like `""e;$(ExtensionsTestVSPath)\\Common7\\IDE\\devenv.exe"e;"` but that didn't work either...
## Expected Behavior
How can I quote the cli argument?
## User Impact
This is pretty much blocking in a general case.
I had to resort to reading the whole command line and treat it as a single argument (i.e., `%*`), but this only works in a scenarios where I have a single argument to pass to a script. If I need more than one argument to pass - there's no way.
## Repro
[9157.zip](https://github.com/dotnet/project-system/files/12066269/9157.zip)
https://github.com/dotnet/project-system/assets/4403806/44e211e0-61b5-4473-8746-2aacd3593856
Contributor guide
Assessment
This issue has not been assessed yet.