Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 239
Igor Popov Avatar asked Mar 03 '17 15:03

Igor Popov


2 Answers

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
like image 165
Martin Prikryl Avatar answered Oct 04 '22 23:10

Martin Prikryl


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"
like image 42
boopzz Avatar answered Oct 05 '22 01:10

boopzz