LoginSignup
9
10

More than 5 years have passed since last update.

Visual Studio Codeで、コマンドラインでExtensionをインストールする

Last updated at Posted at 2019-04-08

やりたいこと

Visual Studio CodeのExtensionを、コマンドラインでインストールしたい。

やり方

Extension管理用のコマンド、--install-extensionを使います。

たとえば、Python用のExtensionをインストールする場合。

$ code --install-extension ms-python.python

プロキシ環境下にいる場合は、https_proxy環境変数を設定しておけばOKです。

インストールされているExtensionを、一括でアップデートしたいなら

--list-extensionsでインストールされているExtensionの一覧が取得できるので、こちらを利用しましょう。

$ code --list-extensions | xargs -I {} code --install-extension {} --force

--forceを付けて、確認をスキップします。

なお、問答無用で新しいバージョンを入れてしまうので、その前提で。

この--forceオプションは、ヘルプで確認することができます。

$ code --help

...

Extensions Management
  --extensions-dir <dir>               Set the root path for extensions.
  --list-extensions                    List the installed extensions.
  --show-versions                      Show versions of installed extensions, when using --list-extension.
  --install-extension <extension-id>   Installs or updates the extension. Use `--force` argument to avoid prompts.
  --uninstall-extension <extension-id> Uninstalls an extension.
  --enable-proposed-api <extension-id> Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.
9
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
10