How to call VS Code Editor from terminal / command line

前端 未结 21 1358
别那么骄傲
别那么骄傲 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 07:07

    You can also run VS Code from the terminal by typing code after adding it to the path:

    Launch VS Code. Open the Command Palette (⇧⌘P) and type shell command to find the Shell Command: Install code command in PATH command. Mac shell commands

    Restart the terminal for the new $PATH value to take effect. You'll be able to type code . in any folder to start editing files in that folder.

    0 讨论(0)
  • 2020-12-04 07:07

    In the case of Linux and Mac, you want to navigate to the directory that you extracted the VSCode files using the 'cd' command. For example:

    cd ~/Downloads/VSCode
    

    Then you start the application by running..

    ./Code
    

    'Code' being the name of the executable.

    If you have root access on the machine, you can configure the system to allow you to start VSCode from anywhere by linking it to /usr/bin, where links to executables are often stored.

    sudo ln -s /path/to/VSCode/folder/Code /usr/bin/Code    
    

    You can now launch VSCode from anywhere by typing:

    Code
    
    0 讨论(0)
  • 2020-12-04 07:07

    Other easyway to do it on mac is :go to Command Palette[ Shift ⇧+ Command (⌘)+P] and type :Shell Command: Install 'code' command in PATH

    once installed: Shell command 'code' successfully installed in PATH.

    Then you can use code from the terminal as well.

    0 讨论(0)
提交回复
热议问题