免互動安裝Go Programming Language、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id GoLang.Go -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id GoLang.Go -e --silentwinget uninstall --id GoLang.Go -e --silent依安裝檔
64位元 · MSI · 所有使用者
靜默安裝
msiexec /i go1.27.0.windows-amd64.msi /qn /norestart寫入記錄檔
msiexec /i go1.27.0.windows-amd64.msi /qn /norestart /l*v "%TEMP%\go-programming-language-install.log"解除安裝
msiexec /x {649B7E21-BFFC-4209-925C-5736BBF28E54} /qn /norestart- MSI產品代碼
- {649B7E21-BFFC-4209-925C-5736BBF28E54}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{649B7E21-BFFC-4209-925C-5736BBF28E54}
- UpgradeCode
- {22EA7650-4AC6-4001-BF29-F4B8775DB1C0}
- 安裝資料夾
- %ProgramFiles%\Go
ARM64 · MSI · 所有使用者
靜默安裝
msiexec /i go1.27.0.windows-arm64.msi /qn /norestart寫入記錄檔
msiexec /i go1.27.0.windows-arm64.msi /qn /norestart /l*v "%TEMP%\go-programming-language-install.log"解除安裝
msiexec /x {0472BCA2-7035-46EA-A36F-EA9B6AEECB31} /qn /norestart- MSI產品代碼
- {0472BCA2-7035-46EA-A36F-EA9B6AEECB31}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0472BCA2-7035-46EA-A36F-EA9B6AEECB31}
- UpgradeCode
- {21ADE9A3-3FDD-4BA6-BEA6-C85ABADC9488}
- 安裝資料夾
- %ProgramFiles%\Go
32位元 · MSI · 所有使用者
靜默安裝
msiexec /i go1.27.0.windows-386.msi /qn /norestart寫入記錄檔
msiexec /i go1.27.0.windows-386.msi /qn /norestart /l*v "%TEMP%\go-programming-language-install.log"解除安裝
msiexec /x {228A82DF-FA4F-4C68-AFD9-39B8344F1C30} /qn /norestart- MSI產品代碼
- {228A82DF-FA4F-4C68-AFD9-39B8344F1C30}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{228A82DF-FA4F-4C68-AFD9-39B8344F1C30}
- UpgradeCode
- {1C3114EA-08C3-11E1-9095-7FCA4824019B}
- 安裝資料夾
- %ProgramFiles(x86)%\Go
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-go-programming-language.ps1
$url = 'https://go.dev/dl/go1.27.0.windows-amd64.msi'
$sha256 = '728E9318C061B95082BCF167BAB8B6C6E0D91A045F89F403B3285FA39F0C455B'
$file = Join-Path $env:TEMP 'go1.27.0.windows-amd64.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait install-go-programming-language.ps1
$url = 'https://go.dev/dl/go1.27.0.windows-arm64.msi'
$sha256 = '9259168CDA232152F3EF0C51149E842E93E4F67DF84713B55CA31128518E97E3'
$file = Join-Path $env:TEMP 'go1.27.0.windows-arm64.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait install-go-programming-language.ps1
$url = 'https://go.dev/dl/go1.27.0.windows-386.msi'
$sha256 = 'A75FE7151E3D9C8C0D43759C92AE320525B49E238510B8FA082B32C1FADFD369'
$file = Join-Path $env:TEMP 'go1.27.0.windows-386.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait