How open folder on VS Code from Command line

To open VS code from the command line you need to do the following:

  1. Click ‘View’ -> `Command Palette’.

  2. Type and find the Shell Command: Install 'code' command in PATH command.

    Screenshot of VS Code Command Palette

  3. Restart your terminal.

Now you will be able to open files and folders from the command line.

Ways to open files / folders

Navigate through the command line to the folder you want and type and enter code . to open VS code in that directory.

You can also write in the command line code path_to_folder to open a specific directory. Or you can write code path_to_file to open a specific file from the command line in VS Code.

Lastly, you can also just write code new_filename.html to open a new file.