How to Update Go on Windows from the Command Prompt: Complete Guide

Update Go on Windows by downloading the latest MSI installer or zip archive from go.dev/dl, then install silently using msiexec /i or extract the zip to C:\Go, and verify with go version.

Keeping your Go toolchain current ensures access to the latest security patches and language features. Whether you prefer the Windows MSI installer or a manual zip extraction, you can update Go on Windows entirely from the command prompt without graphical installers. This guide references the official golang/go repository structure, including the installation documentation in README.md and version naming conventions found in release notes like doc/go1.22.html.

Check Your Current Go Version

Before updating, confirm your existing installation. Open Command Prompt and run:

go version

This outputs the installed release (e.g., go version go1.21.5 windows/amd64). According to the golang/go source, the version string follows the pattern documented in release note files such as doc/go1.22.html, which defines the semantic versioning scheme used by the Windows installers.

Method 1: Update Go on Windows Using the MSI Installer

The MSI method is the cleanest approach for most Windows systems, handling registry updates and path configuration automatically.

Download the Latest Release

Set the version variable and download the installer using PowerShell from Command Prompt:

set LATEST=go1.22.2
powershell -Command "Invoke-WebRequest -Uri https://go.dev/dl/%LATEST%.windows-amd64.msi -OutFile %TEMP%\%LATEST%.msi"

Replace go1.22.2 with the current stable version listed on https://go.dev/dl.

Install Silently via Command Prompt

Execute the MSI using msiexec with quiet mode flags:

msiexec /i "%TEMP%\%LATEST%.msi" /qn

The /qn flag suppresses the graphical interface. Remove it if you prefer interactive installation. This command updates the files in C:\Go (the default GOROOT) and modifies the Windows registry entry for the Go toolchain, as referenced in the installation documentation linked from README.md.

Clean Up and Verify

Remove the temporary installer and confirm the update:

del "%TEMP%\%LATEST%.msi"
go version

The output should now reflect the newly installed version.

Method 2: Update Go on Windows Using the Zip Archive

For portable installations or when you lack administrative privileges, the zip method overwrites the existing installation directly.

Download and Extract

Download the zip archive and extract it to the Go root directory:

set LATEST=go1.22.2
powershell -Command "Invoke-WebRequest -Uri https://go.dev/dl/%LATEST%.windows-amd64.zip -OutFile %TEMP%\%LATEST%.zip"
powershell -Command "Expand-Archive -Path %TEMP%\%LATEST%.zip -DestinationPath C:\ -Force"
del "%TEMP%\%LATEST%.zip"

The -Force parameter overwrites existing files in C:\Go. This approach bypasses the registry modifications performed by the MSI installer but achieves the same result: updating the toolchain binaries in the GOROOT.

How the Update Process Works

Understanding the mechanics ensures you can troubleshoot issues. The golang/go repository defines the installation structure in README.md, which points to the official download site. Version identifiers follow the pattern go1.XX.X documented in release notes like doc/go1.22.html.

When you run msiexec /i, the installer writes new binaries to C:\Go (or your custom GOROOT) and updates the Windows registry to reflect the new version. The zip extraction method performs the same file replacement without registry updates. In both cases, because the Windows PATH environment variable typically points to C:\Go\bin, no PATH modification is required after updating.

Summary

  • Check first: Run go version to identify your current installation.
  • MSI method: Use Invoke-WebRequest to download and msiexec /i ... /qn to install silently.
  • Zip method: Download the archive and use Expand-Archive with -Force to overwrite C:\Go.
  • Verify: Run go version again to confirm the update succeeded.
  • No PATH changes: Both methods update the existing GOROOT, so environment variables remain valid.

Frequently Asked Questions

Do I need to uninstall the old version of Go before updating?

No. Both the MSI installer and the zip extraction method overwrite the existing files in your GOROOT directory (typically C:\Go). The MSI installer handles registry updates automatically, while the zip method simply replaces the binaries. Your existing environment variables and workspace settings remain intact.

Why does the go version command still show the old version after updating?

This usually indicates that the Command Prompt window was opened before the installation completed, or that a different Go binary exists earlier in your PATH. Close all Command Prompt windows and open a new elevated session. If the issue persists, check where go to identify if multiple installations exist and remove outdated entries from your PATH environment variable.

Can I update Go on Windows without administrator privileges?

Yes, but you must use the zip archive method rather than the MSI installer. Download the Windows zip file from https://go.dev/dl, extract it to a directory you own (such as %USERPROFILE%\go), and update your PATH environment variable to point to the new location's bin folder. Note that this creates a user-specific installation rather than updating the system-wide Go installation.

How do I automate the Go update process in a script?

You can automate the update by combining the PowerShell download command with the MSI silent install flag. Create a batch file that sets the LATEST variable to the desired version, uses Invoke-WebRequest to fetch the MSI, and runs msiexec /i "%TEMP%\%LATEST%.msi" /qn. For fully automated version detection, you could parse the latest version from the Go download page JSON API, though this requires additional scripting logic beyond standard command prompt commands.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →