How to use winget to install VSCode with custom options? #1798
-
Hello friends. Thanks so much for winget. I have a quick question. I know that I can install Visual Studio Code with winget by typing: However, doing this will install Visual Studio Code with all default options, which is not what I want. In the Visual Studio Code GUI installer, there is a screen that has a checkbox for adding Visual Studio Code to the right-click context menu, which is a very important feature: These checkboxes are not checked by default. And Is there a way to pass custom installer arguments to winget? And if so, how would I even go about finding out what the correct installer arguments to pass even are? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
You can use the To install VSCode with those options selected, run |
Beta Was this translation helpful? Give feedback.
-
Hello! Will the |
Beta Was this translation helpful? Give feedback.
-
What about those other options, what are the tasks for those? |
Beta Was this translation helpful? Give feedback.
-
So after some tinkering of everything in this thread, and some trial and error (might have needed to restart my computer 3 time and uninstall vscode 10 times) I found a "good" set of options that make vscode install silent in winget: .\VSCodeUserSetup-x64-1.85.0.exe /VERYSILENT /SP- /MERGETAKS="!runcode,!desktopicon,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"
This all make it into my dotfile bootstrap as: Write-Host -ForegroundColor Yellow "🌋 Force reinstall of VS-Code to ensure Path and Shell integration"
winget install --force Microsoft.VisualStudioCode --override '/VERYSILENT /SP- /MERGETAKS="!runcode,!desktopicon,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"' |
Beta Was this translation helpful? Give feedback.
You can use the
--override
argument onwinget install
to replace the arguments winget uses with ones you want yourself. Unfortunately, you'll probably have to do some googling or run the installer with/?
to get all possible arguments.To install VSCode with those options selected, run
winget install Microsoft.VisualStudioCode --override '/SILENT /mergetasks="!runcode,addcontextmenufiles,addcontextmenufolders"'