Issue
If you put VS Code bin in %PATH% variable, the following can be noticed:
Root Cause
The root cause of the issue is that VSCode installer adds the following string in %PATH% variable:
C:\Program Files\Microsoft VS Code\bin
That makes code.cmd executable start when user calls "code" from Run command prompt.
Workaround
If you want to run Code.exe instead of code.cmd, you may want to change value in %PATH% from "C:\Program Files\Microsoft VS Code\bin" to "C:\Program Files\Microsoft VS Code"
Request
Would it be possible to adjust installer settings so that it puts "C:\Program Files\Microsoft VS Code" in %PATH% variable?
Otherwise I probably can make a pull request with the note on how to start VS Code directly.
Thanks for your investigation, but the current PATH variable value is purposeful.
This is a consequence of Electron's architecture and the lack of having our own exe launcher. Electron.exe doesn't let us have a stdout, when running normally, only when running with ELECTRON_RUN_AS_NODE. In order to implement all the CLI tasks (--install-extension, etc) we simply can't let Code.exe be in the PATH. Instead, we use code.cmd for that: it sets up the right environment which lets us run Electron as a command line tool.
Typing code in Run and having a command prompt open up is a sad consequence of all this mess... We can't fix it until we create our own exe. There's already an issue on Microsoft/vscode for this.
Most helpful comment
Thanks for your investigation, but the current PATH variable value is purposeful.
This is a consequence of Electron's architecture and the lack of having our own exe launcher. Electron.exe doesn't let us have a stdout, when running normally, only when running with
ELECTRON_RUN_AS_NODE. In order to implement all the CLI tasks (--install-extension, etc) we simply can't let Code.exe be in the PATH. Instead, we usecode.cmdfor that: it sets up the right environment which lets us run Electron as a command line tool.Typing
codeinRunand having a command prompt open up is a sad consequence of all this mess... We can't fix it until we create our own exe. There's already an issue on Microsoft/vscode for this.