Vscode-docs: Running VS Code from Run Command Prompt is causing CMD Window to pop up

Created on 16 Mar 2018  路  1Comment  路  Source: microsoft/vscode-docs

Issue
If you put VS Code bin in %PATH% variable, the following can be noticed:

  1. User opens Run command Prompt either with either Windows key + R combination or directly through menu
  2. User types "code" in Run command prompt
  3. Cmd.exe starts
  4. Visual Studio Code appears

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.

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 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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tetchel picture tetchel  路  3Comments

krave1986 picture krave1986  路  4Comments

gregvanl picture gregvanl  路  4Comments

yohanmishkin picture yohanmishkin  路  6Comments

jrieken picture jrieken  路  4Comments