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: 5 comments 6 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.
-
Fixing Missing Context Menu Entries in VS Code Installed via WingetTL;DR - Working Commandwinget install --force Microsoft.VisualStudioCode --override '/VERYSILENT /SP- /MERGETASKS="addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"' The Issue & SolutionMany users experience missing "Open with Code" options in context menus after installing VS Code via winget. This comprehensive guide explains the issue and provides solutions for proper installation. Root Cause IdentifiedThe problem occurs due to a parameter typo in a commonly shared command: winget install --force Microsoft.VisualStudioCode --override '/VERYSILENT /SP- /MERGETAKS="!runcode,!desktopicon,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"' Note the misspelling: This subtle typo has significant consequences: the VS Code installer silently ignores unrecognized parameters without displaying any error, resulting in default installation settings that skip context menu integration. Parameter ExplanationLet's break down the correct command: Winget Parameters
VS Code Installer Parameters
Key MERGETASKS Options
How to Fix an Existing InstallationIf you've already installed VS Code without context menu integration:
Installation Options for Different NeedsStandard Installation (Recommended)winget install --force Microsoft.VisualStudioCode --override '/VERYSILENT /SP- /MERGETASKS="addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"' Complete Installation with All Featureswinget install --force Microsoft.VisualStudioCode --override '/VERYSILENT /SP- /MERGETASKS="runcode,desktopicon,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"' Minimal Installation with Context Menu Onlywinget install --force Microsoft.VisualStudioCode --override '/VERYSILENT /SP- /MERGETASKS="!runcode,!desktopicon,addcontextmenufiles,addcontextmenufolders,!associatewithfiles,addtopath"' Advanced: Understanding MERGETASKS Behavior
Example: Available VS Code Installer OptionsReferencesI hope this helps anyone encountering the same issue. Feel free to add any questions or additional information in the comments. |
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"'