Activate Windows from the command line

The built-in slmgr tool can install a key and activate Windows in two commands.

Updated October 2026

Open an admin command prompt

  1. Right-click the Start button.
  2. Choose Terminal (Admin) or Command Prompt (Admin), then select Yes.

Install the key and activate

  1. Type slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX with your own key and press Enter. Wait for the confirmation window.
  2. Type slmgr /ato and press Enter to activate online.
  3. Type slmgr /xpr to confirm. It should say the machine is permanently activated.

Other useful commands

CommandWhat it does
slmgr /dliShows the edition and last five characters of the key
slmgr /upkRemoves the installed key
slmgr /cpkyClears the key from the registry
slmgr /rearmResets the licensing status (rarely needed)

If you get an error

Look up the code in Windows activation error codes. The most common cause is a key for a different edition, for example a Pro key on Home.

Keys mentioned in this guide

Still stuck?Send us a screenshot and your order number on the contact page. If a key we sold you won't activate, we fix it or send a replacement.