wingetsilent-installvscodevisual-studio-codetutorial
Microsoft Visual Studio Code

How to Install Visual Studio Code Silently with winget on Windows

Install VS Code silently with winget — single-line command for unattended deployments, with --scope user, custom flags, and uninstall examples.

· 4 min read · updated May 29, 2026

Visual Studio Code is the most-installed dev tool on Windows. Here's the silent install workflow with winget — including per-user vs system-wide install, extension auto-installation, and team-wide configuration.

TL;DR

Open Terminal as Administrator:

winget install --id Microsoft.VisualStudioCode -e --silent --accept-package-agreements --accept-source-agreements

VS Code installs system-wide to C:\Program Files\Microsoft VS Code. Ready to use in 30 seconds.

Per-user install (no admin)

If you don't have admin rights, VS Code installs cleanly per-user:

winget install --id Microsoft.VisualStudioCode -e --scope user --silent

Installs to %LOCALAPPDATA%\Programs\Microsoft VS Code. Same functionality, no admin needed. This is actually Microsoft's recommended approach for individual developers.

What gets installed

Field Value
Package ID Microsoft.VisualStudioCode
Publisher Microsoft Corporation
Installer type Inno Setup
License Microsoft Software License
Latest version 1.121.0
Homepage code.visualstudio.com
Default install path C:\Program Files\Microsoft VS Code (machine) or %LOCALAPPDATA%\Programs\Microsoft VS Code (user)

The installer registers:

  • code on PATH (open files / folders from terminal)
  • Right-click "Open with Code" context menu (with --override)
  • File associations for code file types

Pre-install extensions

After installing VS Code silently, install extensions via the code CLI:

# Wait for VS Code's PATH update to propagate
Start-Sleep -Seconds 2

code --install-extension ms-python.python
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension biomejs.biome
code --install-extension GitHub.copilot
code --install-extension ms-vscode-remote.remote-wsl

You can pre-load whatever extension pack matches your team's stack. See dev-environment guides:

Customise with override flags

VS Code's Inno installer accepts component flags:

winget install --id Microsoft.VisualStudioCode -e --override "/VERYSILENT /NORESTART /MERGETASKS=!runcode,addcontextmenufiles,addcontextmenufolders,associatewithfiles,addtopath"

Common MERGETASKS flags:

Flag Effect
addcontextmenufiles "Open with Code" on files
addcontextmenufolders "Open with Code" on folders
associatewithfiles Register as default for code file types
addtopath Add code to PATH
!runcode DON'T launch VS Code after install (negation)

Useful for unattended deployments where you don't want the IDE to open at the end.

VS Code Insiders

For the bleeding-edge build:

winget install --id Microsoft.VisualStudioCode.Insiders -e --silent

Insiders runs side-by-side with stable. Useful for testing new features without breaking your main install.

Variations

Specify version

winget install --id Microsoft.VisualStudioCode -e --version 1.118.0 --silent

List available versions:

winget show --id Microsoft.VisualStudioCode --versions

Pin to a major version

To prevent winget upgrade from jumping to a different release line:

winget pin add --id Microsoft.VisualStudioCode --version "1.121.*"

See winget pin guide.

Verify

code --version
# 1.121.0
# (commit hash)
# x64

Upgrade silently

winget upgrade --id Microsoft.VisualStudioCode -e --silent --accept-package-agreements --accept-source-agreements

VS Code self-updates anyway by default (Auto Update setting), so weekly winget upgrade --all rarely shows it as outdated. If you've disabled auto-update for compliance reasons, winget handles it.

Uninstall silently

winget uninstall --id Microsoft.VisualStudioCode --silent --disable-interactivity

To also wipe your settings, extensions, and workspace state:

winget uninstall --id Microsoft.VisualStudioCode --silent
Remove-Item "$env:APPDATA\Code" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\.vscode" -Recurse -Force -ErrorAction SilentlyContinue

Detailed: How to uninstall Windows apps with winget.

Full team-standard setup script

# 1. Install VS Code
winget install --id Microsoft.VisualStudioCode -e --scope user --silent `
  --accept-package-agreements --accept-source-agreements

# 2. Wait for PATH propagation
Start-Sleep -Seconds 3

# 3. Install team extensions
@(
  "GitHub.copilot",
  "GitHub.copilot-chat",
  "dbaeumer.vscode-eslint",
  "esbenp.prettier-vscode",
  "ms-azuretools.vscode-docker",
  "ms-vscode-remote.remote-wsl",
  "EditorConfig.EditorConfig"
) | ForEach-Object { code --install-extension $_ }

# 4. Apply team settings.json
$settingsPath = "$env:APPDATA\Code\User\settings.json"
@"
{
  "editor.formatOnSave": true,
  "editor.tabSize": 2,
  "editor.insertSpaces": true,
  "files.trimTrailingWhitespace": true,
  "telemetry.telemetryLevel": "off"
}
"@ | Out-File -Encoding utf8 $settingsPath

Run on every new dev machine. ~2 minutes start to finish.

Common errors

"App is already installed" — winget detected an existing copy. Force-reinstall:

winget install --id Microsoft.VisualStudioCode -e --silent --force

"Multiple installer matches" — VS Code has User and System installer variants. Add --scope:

winget install --id Microsoft.VisualStudioCode -e --scope user --silent

code command not found after install — restart Terminal. PATH only refreshes for new processes.

"Installer hash does not match" — manifest lag. Wait 24h or --force. See hash mismatch fix.

See also

Continue reading