How to install Visual Studio Code silently (without auto open when installation ends)?

There's a hidden task runcode, that gets automatically selected for silent installations. To unselect the runcode task, use the /MERGETASKS=!runcode option.

VSCodeSetup-1.10.1.exe /VERYSILENT /MERGETASKS=!runcode

(Credits for the /MERGETASKS=!runcode go to @RobertWigley)


The above is based on build/win32/code.iss in the GitHub repo:

[Tasks]
Name: "runcode"; Description: "{cm:RunAfter,{#NameShort}}"; \
    GroupDescription: "{cm:Other}"; Check: WizardSilent

[Run]
Filename: "{app}\{#ExeBasename}.exe"; \
    Description: "{cm:LaunchProgram,{#NameLong}}"; Tasks: runcode; \
    Flags: nowait postinstall; Check: ShouldRunAfterUpdate
Filename: "{app}\{#ExeBasename}.exe"; \
    Description: "{cm:LaunchProgram,{#NameLong}}"; \
    Flags: nowait postinstall; Check: WizardNotSilent

I found to run within Powershell I used Start-Process, Execute-Process seemed to be deprecated for me.

The below is the line I use.

Start-Process -FilePath "path/to/vscode/VSCodeUserSetup-x64.exe" -Argument "/VERYSILENT /MERGETASKS=!runcode"