DSE
DSE

Reputation: 21

VSCode CLI install extension from local file with powershell

I am trying to use PowerShell to install a VSCode extension from a local file (not from the internet).

When I use Start-Process and give the appropriate file path, it opens VSCode, stalls the script, and does not install the extension. When I close VSCode, the script terminates without error, but still the extensions is not installed.

I need the exact syntax to install a VSCode extension from PowerShell silently (no new window).

I've tried just about every syntax variation.

Thanks

Upvotes: 0

Views: 719

Answers (1)

Bob Randy
Bob Randy

Reputation: 1

Instead of using Start-Process, call the default name for VS Code: code. VS Code has some nice CLI options when you call this, one of which is --install-extension. Heres an example of what you can call in powershell or in a .ps1 script that would do this:

code --install-extension path/to/extension.ts

or if you have made an extension pack to help automate the install of multiple extensions at once:

code --install-extension path/to/extensionPack.vsix 

Upvotes: 0

Related Questions