How to call VS Code Editor from terminal / command line

Levon picture Levon · Apr 30, 2015 · Viewed 136.2k times · Source

The question says it all.

How can I open VS Code editor from

  • windows cmd
  • linux and mac terminal

e.g. for notepad++ I write

> start notepad++ test.txt

By the way, the editor is awesome (cross-platform)! Thank you Nadella!

You can download it from microsoft

Answer

Laily picture Laily · Oct 19, 2016

To open a file or directory use the command:

code /path/to/file/or/directory/you/want/to/open

For macOS users, it needs to be installed manually:

  1. Launch VS Code.
  2. Command + Shift + P to open the Command Palette.
  3. Type shell command, to find the Shell Command: Install 'code' command in PATH and select to install it.
  4. Restart your terminal.