At work, there is an enterprise security policy where all executables are only allowed to run out of C:\Program Files
or C:\Program Files (x86)
.
In Visual Studio Code, in settings.json
, using the following settings:
{
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k C:\\Program Files (x86)\\Cmder\\vendor\\init.bat"
]
}
...on initialization for the integrated terminal, I receive the following error message:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Because of Windows' awesome file/directory naming convention allowing spaces, it is difficult to point to one of the Program File
paths.
VSCode doesn't like it when you escape the space character, and this code gives me the error Invalid escape character in string
. When I try to change the property to this:
{
...
"terminal.integrated.shellArgs.windows": [
"/k C:\\Program\ Files\ (x86)\\Cmder\\vendor\\init.bat"
]
}
...I get the following error message:
'C:\ProgramFiles' is not recognized as an internal or external command,
operable program or batch file.
Lastly, trying to surround the path in quotes like this:
{
...
"terminal.integrated.shellArgs.windows": [
"/k \"C:\\Program Files (x86)\\Cmder\\vendor\\init.bat\""
]
}
...gives me this error message:
'\"C:\Program Files (x86)\Cmder\vendor\init.bat\""' is not recognized as an
internal or external command,
operable program or batch file.
Is there any way to integrate Cmder in VSCode?
"C:\\\"Program Files (x86)\"\\Cmder\\vendor\\init.bat"
. I know the issue is already resolved in other ways but I hope this tidbit is useful regardless. – Sulphate