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 th
First, find the fully qualified extension name. To do this, you can right-click a given extension, and select 'Copy Extension Id' (while in the extensions pane).
Since the other answers already illustrate .BAT/.CMD syntax, here's an example of installing extensions using a Powershell script (which can of course be executed from CMD).
# A system-wide install of VSCode might be in: "C:\Program Files\Microsoft VS Code\bin\code"
param(
[string] $pathToVsCodeExe = ($Env:USERPROFILE + '\AppData\Local\Programs\Microsoft VS Code'),
[string[]] $extensions = @("editorconfig.editorconfig", "dbaeumer.vscode-eslint")
)
try {
$originalLocation = Get-Location
Set-Location $pathToVsCodeExe
$extensions | ForEach-Object {
Invoke-Expression -Command "Code --install-extension $_ --force"
}
}
catch {
$_
}
finally {
Set-Location $originalLocation
}