推奨は
winget install Microsoft.VisualStudioCode --override "/mergetasks=addcontextmenufiles,addcontextmenufolders,!runcode /lang=english /verysilent"
winget で install したら
オプションないの? と思い
「vscodeusersetup option command line」でググると
どうも、jordan russell's software の Inno Setup ってのが使われてて、オプションは以下の通りらしい。
VSCodeUserSetup-x64-1.64.0.exe /? とかするとダイアログで以下の内容も確認できる。
という事で、以下のようにすればいいようだ。
2022-02-18: 追記
全然駄目だった。
推奨は
/lang=english は必須。
vscode 本体は基本的に英語版(で、あとから日本語 plugin を導入可能)何だけど、インストーラーがなまじ多言語化されてて、環境に合わせた言語で動作するのがデフォルトになっているため、addcontextmenufiles,addcontextmenufolders が日本語化されてしまい、「Open w&ith Code」ではなく「Code で開く」で登録されてしまうため、アクセスキー(i)が使えないのが致命的だった。
関連:
「winget install overwrite」でググると、以下のページも参考になった。
- エクスプローラーのファイル コンテキスト メニューに [Code で開く] アクションを追加する
- エクスプローラーのディレクトリ コンテキスト メニューに [Code で開く] アクションを追加する
オプションないの? と思い
- GitHub / microsoft / winget-pkgs / manifests / m / Microsoft / VisualStudioCode
「vscodeusersetup option command line」でググると
- stackoverflow / 2017-03-03: How to install Visual Studio Code silently (without auto open when installation ends)?
どうも、jordan russell's software の Inno Setup ってのが使われてて、オプションは以下の通りらしい。
- jordan russell's software / Inno Setup Help / Setup Command Line Parameters # MERGETASKS
VSCodeUserSetup-x64-1.64.0.exe /? とかするとダイアログで以下の内容も確認できる。
The Setup program accepts optional command line parameters. /HELP, /? Shows this information. /SP- Disables the This will install... Do you wish to continue? prompt at the beginning of Setup. /SILENT, /VERYSILENT Instructs Setup to be silent or very silent. /SUPPRESSMSGBOXES Instructs Setup to suppress message boxes. /LOG Causes Setup to create a log file in the user's TEMP directory. /LOG="filename" Same as /LOG, except it allows you to specify a fixed path/filename to use for the log file. /NOCANCEL Prevents the user from cancelling during the installation process. /NORESTART Prevents Setup from restarting the system following a successful installation, or after a Preparing to Install failure that requests a restart. /RESTARTEXITCODE=exit code Specifies a custom exit code that Setup is to return when the system needs to be restarted. /CLOSEAPPLICATIONS Instructs Setup to close applications using files that need to be updated. /NOCLOSEAPPLICATIONS Prevents Setup from closing applications using files that need to be updated. /FORCECLOSEAPPLICATIONS Instructs Setup to force close when closing applications. /FORCENOCLOSEAPPLICATIONS Prevents Setup from force closing when closing applications. /LOGCLOSEAPPLICATIONS Instructs Setup to create extra logging when closing applications for debugging purposes. /RESTARTAPPLICATIONS Instructs Setup to restart applications. /NORESTARTAPPLICATIONS Prevents Setup from restarting applications. /LOADINF="filename" Instructs Setup to load the settings from the specified file after having checked the command line. /SAVEINF="filename" Instructs Setup to save installation settings to the specified file. /LANG=language Specifies the internal name of the language to use. /DIR="x:\dirname" Overrides the default directory name. /GROUP="folder name" Overrides the default folder name. /NOICONS Instructs Setup to initially check the Don't create a Start Menu folder check box. /TYPE=type name Overrides the default setup type. /COMPONENTS="comma separated list of component names" Overrides the default component settings. /TASKS="comma separated list of task names" Specifies a list of tasks that should be initially selected. /MERGETASKS="comma separated list of task names" Like the /TASKS parameter, except the specified tasks will be merged with the set of tasks that would have otherwise been selected by default. /PASSWORD=password Specifies the password to use. For more detailed information, please visit https://jrsoftware.org/ishelp/index.php?topic=setupcmdline
という事で、以下のようにすればいいようだ。
winget install Microsoft.VisualStudioCode --override "/mergetasks=addcontextmenufiles,addcontextmenufolders /verysilent"
2022-02-18: 追記
全然駄目だった。
推奨は
winget install Microsoft.VisualStudioCode --override "/mergetasks=addcontextmenufiles,addcontextmenufolders,!runcode /lang=english /verysilent"!runcode はインストール直後に vscode を起動するタスクの否定なので、あってもなくてもいいが、
/lang=english は必須。
vscode 本体は基本的に英語版(で、あとから日本語 plugin を導入可能)何だけど、インストーラーがなまじ多言語化されてて、環境に合わせた言語で動作するのがデフォルトになっているため、addcontextmenufiles,addcontextmenufolders が日本語化されてしまい、「Open w&ith Code」ではなく「Code で開く」で登録されてしまうため、アクセスキー(i)が使えないのが致命的だった。
関連:
- Visual Studio Code # 2020-04-02: explorer.exe のポップアップメニューでのアクセスキー
「winget install overwrite」でググると、以下のページも参考になった。
- Microsoft / Docs / Windows / 開発環境 / Windows パッケージ マネージャー / install コマンド (winget)
- Zenn
- 2021-10-05: wingetでインストーラーオプションを指定する
- 2021-10-05: Visual Studio Codeのサイレントインストール
タグ

コメントをかく