Microsoft Visual Studio Codeを確認画面なしでインストール・アンインストールし、展開ツールで検出するためのコマンドです。マニフェストの記載か、インストーラー技術の既定値として確実なコマンドだけを表示しています。
関連ガイド: サイレントインストールのオプション一覧 · レジストリとPowerShellでアンインストールする方法
wingetを使う
PowerShell
winget install --id Microsoft.VisualStudioCode -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Microsoft.VisualStudioCode -e --silentwinget uninstall --id Microsoft.VisualStudioCode -e --silentインストーラー別
64ビット · EXE(Inno Setup) · 現在のユーザー · en-US
サイレントインストール
VSCodeUserSetup-x64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-インストール先を指定
VSCodeUserSetup-x64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /DIR="C:\Apps\microsoft-visual-studio-code"64ビット · EXE(Inno Setup) · すべてのユーザー · en-US
サイレントインストール
VSCodeSetup-x64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-インストール先を指定
VSCodeSetup-x64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /DIR="C:\Apps\microsoft-visual-studio-code"ARM64 · EXE(Inno Setup) · 現在のユーザー · en-US
サイレントインストール
VSCodeUserSetup-arm64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-インストール先を指定
VSCodeUserSetup-arm64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /DIR="C:\Apps\microsoft-visual-studio-code"ARM64 · EXE(Inno Setup) · すべてのユーザー · en-US
サイレントインストール
VSCodeSetup-arm64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-インストール先を指定
VSCodeSetup-arm64-1.141.2.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /DIR="C:\Apps\microsoft-visual-studio-code"PowerShell:ダウンロード・検証・インストール
公式ファイルをダウンロードし、SHA256を検証してからサイレントインストールします。
install-microsoft-visual-studio-code.ps1
$url = 'https://vscode.download.prss.microsoft.com/dbazure/download/stable/16507d91be0dc1ce4f94c04d4d0430210b8685d9/VSCodeUserSetup-x64-1.141.2.exe'
$sha256 = '9B9E7305BC5F2D9176DFF8263BA146FC7B0D65CE1FB499271FD7746EC53D66ED'
$file = Join-Path $env:TEMP 'VSCodeUserSetup-x64-1.141.2.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -Wait install-microsoft-visual-studio-code.ps1
$url = 'https://vscode.download.prss.microsoft.com/dbazure/download/stable/16507d91be0dc1ce4f94c04d4d0430210b8685d9/VSCodeSetup-x64-1.141.2.exe'
$sha256 = '43E9E2DF672BA5CEB500E5CA6304297183AD195A323B8D73C70C7DF2D60E333F'
$file = Join-Path $env:TEMP 'VSCodeSetup-x64-1.141.2.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -Wait install-microsoft-visual-studio-code.ps1
$url = 'https://vscode.download.prss.microsoft.com/dbazure/download/stable/16507d91be0dc1ce4f94c04d4d0430210b8685d9/VSCodeUserSetup-arm64-1.141.2.exe'
$sha256 = '7EA3A25FA828C229DC8B79187EA3C6A35178A9243DD9AD1C1A4E6458CD60D8ED'
$file = Join-Path $env:TEMP 'VSCodeUserSetup-arm64-1.141.2.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -Wait install-microsoft-visual-studio-code.ps1
$url = 'https://vscode.download.prss.microsoft.com/dbazure/download/stable/16507d91be0dc1ce4f94c04d4d0430210b8685d9/VSCodeSetup-arm64-1.141.2.exe'
$sha256 = '68A31F854F0D1DFF3F17DFE02ACBAD9238B1888DBD5BD344185C067B034B14FD'
$file = Join-Path $env:TEMP 'VSCodeSetup-arm64-1.141.2.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-' -Wait