How to call VS Code Editor from terminal / command line

前端 未结 21 1357
别那么骄傲
别那么骄傲 2020-12-04 06:22

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

相关标签:
21条回答
  • 2020-12-04 06:49

    For command line heads you can also run

    sudo ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code

    this will do the exact same thing as the Shell Command: Install 'code' command in PATH command feature in VSCode.

    0 讨论(0)
  • 2020-12-04 06:49

    typing "code" in dos command prompt worked for me

    0 讨论(0)
  • 2020-12-04 06:49

    Step 1: create a .bat file with the name you want e.g vscode.bat Step 2: Write your path to Visual Studio Code Step 3: Save it in C:\Windows\System32 directory

    **
    C:
    cd Users\Bino\AppData\Local\Programs\Microsoft VS Code
    Code.exe**
    

    Step 4: You can call visual studio code from any where by typing "vscode" which is the name of your bat file

    0 讨论(0)
  • 2020-12-04 06:53

    Sometimes setting path from VS Code command palette does not work

    Instead manually add your VS Code to your path:

    1. Run in terminal

      sudo nano /etc/paths

    2. Go to the bottom of the file, and enter the path you wish to add

    3. Hit control-x to quit. Enter “Y” to save the modified buffer.

    4. Restart your terminal and to test echo $PATH. You should something similar

    ~ echo $PATH /Users/shashank/.nvm/versions/node/v8.9.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin

    Next time, you navigate to your project folder from terminal

    Enter:

    code .

    or

    code /path/to/project

    Source

    0 讨论(0)
  • 2020-12-04 06:54

    Delete old virtual environment and create a fresh virtual environment.

    0 讨论(0)
  • 2020-12-04 06:55

    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.
    0 讨论(0)
提交回复
热议问题