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

4

16

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?

Humo answered 3/3, 2017 at 15:4 Comment(1)
Related: How to silently install Visual Studio Code on Windows?Implantation
C
29

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

VSCodeUserSetup-x64-1.86.2.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
Countervail answered 3/3, 2017 at 15:36 Comment(0)
U
6

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"
Unconformable answered 19/3, 2019 at 8:47 Comment(1)
I found some additional arguments helpful: '/verysilent /suppressmsgboxes /mergetasks=!runcode,desktopicon'.Lipoid
I
0

Execute-Process is a built-in function for PowerShell Application Deployment Toolkit (PSADT) and the -Parameters parameter is also not a standard parameter, but part of that custom function.

Instead, use Start-Process -FilePath "VSCode.exe" -ArgumentList "/VERYSILENT /MERGETASKS=!runcode"

You can pass any of the arguments in the -ArgumentList

Ichor answered 9/12, 2022 at 16:5 Comment(0)
G
-1

Execute-Process -Path "VSCodeUserSetup-x64-1.30.1.exe" -Parameters "/VERYSILENT /CLOSEAPPLICATIONS

you can use this for PowerShell installation.

Gastongastralgia answered 28/12, 2018 at 17:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.