How to install Visual Studio Code extensions from Command line
How to install Visual Studio Code Extensions from Command Prompt while Code Instance is open. I want to install extension from Visual Studio Code gallery.
Following is the extension data i want to install.
My Visual Studio Code Instance is open. What i want to do is to install the following extension from command prompt.
Solution 1:
To make it easier to automate and configure VS Code, it is possible to list, install, and uninstall extensions from the command line. When identifying an extension, provide the full name of the form publisher.extension, for example donjayamanne.python.
code --list-extensions
code --install-extension ms-vscode.cpptools
code --uninstall-extension ms-vscode.csharp
Documentation
Solution 2:
According to the documentation, you can use --install-extension
for that. For example:
code --install-extension ms-vscode.csharp
Solution 3:
To add to Shan Khan's answer above, if you want to install extensions in a .bat file, you have to use the call
keyword, otherwise your script exits after the extension installation completes. Also, if code.exe is not already in the path and you are calling using a full path, make sure you're pointing at the /bin
directory:
echo.
echo.
echo Installing VS Code Extensions...
call "C:\Program Files\Microsoft VS Code\bin\code" --install-extension ritwickdey.liveserver
call "C:\Program Files\Microsoft VS Code\bin\code" --install-extension ritwickdey.live-sass
call "C:\Program Files\Microsoft VS Code\bin\code" --install-extension ms-vscode.csharp
call "C:\Program Files\Microsoft VS Code\bin\code" --install-extension PKief.material-icon-theme
echo Done.
echo.
echo.