How to call VS Code Editor from terminal / command line

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

    When installing on Windows, you will be prompted to add VS Code to your PATH.

    I was trying to figure out how to open files with VS Code from the command line and I already had the capability - I just forgot I had already added it. You might already have it installed - check by navigating to a folder you want to open and running the command code . to open that folder.

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

    This will work. This is your directory name "Directory_Name"

     sudo code --user-data-dir="Directory_Name"
    
    0 讨论(0)
  • 2020-12-04 06:42

    VS Code is a must have code editor for 2018

    For Windows 10 users a lot is possible, the same way the Mac OS users type code . .

    Look for you VS Code \bin folder path e.g C:\Program Files\Microsoft VS Code\bin . The bin folder includes a file called code.cmd

    Follow the steps below and be proud of the OS you use.

    1. Search for "Advanced System Setting" from Start.

    2. Click on Environment Variables

    3. On System Variables choose "path" from Variable tab and click on Edit.

    4. Click on New on the right side of the popup window.

    5. Copy your path from the Explorer's breadcrumb path and paste it into the new opened path in step 4, example:- C:\Program Files\Microsoft VS Code\bin

    6. Click Ok on all the open windows to confirm changes and restart your cmd

    7. Go to your cmd and navigate to you working directory on server and type code .

    C:>cd wamp64\www\react-app> code . to open with VS Code on Windows.

    Visual Studio Code also includes a command prompt (terminal) window and you can open one or more of them with
    Ctrl + ` on your keyboard.

    Hope this helps some one like it did to many of us.

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

    In windows you can add following path to environment variable

    C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
    
    0 讨论(0)
  • 2020-12-04 06:47

    Open command line and type:

    cd your_folder_path
    code.cmd . 
    

    or

    code.cmd your_folder_path
    

    It will open your folder in Visual Studio Code. Make Sure, you are inside the correct folder after executing "cd your_folder_path" command.

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

    A simple way is to go to your Project where you want to open it and type

    code.cmd D:\PathTo\yourProject\MyProject

    That's it. It will open your project in Visual Studio Code.

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