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

Igor Popov picture Igor Popov · Mar 3, 2017 · Viewed 17.1k times · Source

I found the option to install silently from command line (vscode-installer.exe /VERYSILENT), BUT it still opens automatically at the end of the installation, thus making unattended installation on multiple computers inconvenient.

I checked Inno Setup's documentation (that's what the Visual Studio Code installer uses), but there's nothing related to disabling Visual Studio Code autostart (even on very silent installation).

There might be a way by using /COMPONENTS, /TASKS or /MERGETASKS, but for that I need to know what is already available for use.

Is there a way to make it install completely silently?

Answer

Martin Prikryl picture Martin Prikryl · Mar 3, 2017

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