Skip to content

Instantly share code, notes, and snippets.

@EmmanuelTsouris
Last active January 6, 2024 02:49
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save EmmanuelTsouris/00bcaa9a3787a6451af5567f74b4e1c6 to your computer and use it in GitHub Desktop.
Save EmmanuelTsouris/00bcaa9a3787a6451af5567f74b4e1c6 to your computer and use it in GitHub Desktop.
Download and Silently Install Visual Studio Code (VSCode)
#Install-VSCode
# Download URL, you may need to update this if it changes
$downloadUrl = "https://go.microsoft.com/fwlink/?LinkID=623230"
# What to name the file and where to put it
$installerFile = "vscode-install.exe"
$installerPath = (Join-Path $env:TEMP $installerFile)
# Install Options
# Reference:
# http://stackoverflow.com/questions/42582230/how-to-install-visual-studio-code-silently-without-auto-open-when-installation
# http://www.jrsoftware.org/ishelp/
# I'm using /silent, use /verysilent for no UI
# Install with the context menu, file association, and add to path options (and don't run code after install:
$installerArguments = "/silent /mergetasks='!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath'"
#Install with default options, and don't run code after install.
#$installerArguments = "/silent /mergetasks='!runcode'"
Write-Verbose "Downloading $installerFile..."
Invoke-Webrequest $downloadUrl -UseBasicParsing -OutFile $installerPath
Write-Verbose "Installing $installerPath..."
Start-Process $installerPath -ArgumentList $installerArguments -Wait
Write-Verbose "Cleanup the downloaded file."
Remove-Item $installerPath -Force
@VertigoRay
Copy link

Thanks for the /mergetasks. I came up with a more robust installer tho:
https://github.com/UNT-CAS/Update-VSCode

@roysubs
Copy link

roysubs commented Apr 3, 2020

What switch enables installation in portable mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment