You have a Windows product key, but the Settings page won’t take it, or you’d rather activate from the command line. Windows 10 and Windows 11 both include a built-in activation tool called slmgr (Software Licensing Management Tool) that you run from Command Prompt. Three commands do the whole job: install the key, activate, check the result.

This guide shows the exact commands, what each one does, and what to do when a command returns an error. It works for Windows 11 Pro, Windows 11 Home, Windows 10 Pro and Windows 10 Home, with a genuine retail or OEM key.

Quick answerLast updated:

To activate Windows 10 or 11 with CMD, open Command Prompt as administrator and run slmgr /ipk followed by your 25-character product key, then run slmgr /ato to activate online. Run slmgr /xpr to confirm it says the machine is permanently activated. The commands are the same on Windows 10 and Windows 11, and they only change the license, not your files.

Video guide · 5:06

Watch: activate Windows with CMD step by step

Prefer watching? This video opens Command Prompt as administrator, runs slmgr /ipk and slmgr /ato, checks the result with slmgr /xpr, slmgr /dli and the Settings page, then covers the other useful slmgr commands and the common errors.

Watch on the KRBKeys YouTube channel →

Short on time? Watch the short version

The same fix in a quick vertical video made for phones. Open it on YouTube Shorts →

Before you start

  • Use a key for your edition. A Windows 11 Pro key activates Pro, a Home key activates Home. Check your edition under Settings → System → About → Windows specifications. Entering a Pro key on a Home install upgrades it to Pro after a restart.
  • Be online. slmgr /ato contacts Microsoft’s activation servers. If you’re offline, use phone activation instead (see the commands below).
  • Have the 25-character key ready. It looks like XXXXX-XXXXX-XXXXX-XXXXX-XXXXX. Keep the dashes.
  • Your files are safe. These commands only change the license. Nothing is reinstalled or deleted.

Step 1: Open Command Prompt as administrator

slmgr needs administrator rights, or the commands silently fail.

  1. Click Start and type cmd.
  2. Right-click Command Prompt and choose Run as administrator. Click Yes on the User Account Control prompt.
  3. You should see C:\Windows\System32> in the black window. If it says C:\Users\YourName> instead, you opened a normal prompt: close it and try again.

Windows Terminal or PowerShell (run as administrator) work just as well. The commands are the same.

Step 2: Install your product key with slmgr /ipk

  1. Type the following command, replacing the X’s with your key, and press Enter:
    slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
  2. After a few seconds a small window pops up: “Installed product key XXXXX-XXXXX-XXXXX-XXXXX-XXXXX successfully.” Click OK.

/ipk stands for install product key. It replaces whatever key Windows had before, including a generic installation key or an old volume (KMS) key. If you see “The Software Licensing Service reported that the product key is invalid”, check for a typo first: Windows keys never contain the letters A, E, I, L, O, S, U or Z, or the digits 0, 1 and 5.

Step 3: Activate Windows with slmgr /ato

  1. Type the following command and press Enter:
    slmgr /ato
  2. Wait for the pop-up: “Activating Windows(R), Professional edition … Product activated successfully.” Click OK.

/ato means activate online. Windows sends the key to Microsoft and gets the activation back. If the pop-up shows an error code instead, jump to the errors section below.

Step 4: Check the activation status

  1. Type:
    slmgr /xpr

    A pop-up says “The machine is permanently activated.” That’s it.

  2. For more detail, type slmgr /dli. The License Status line should say Licensed, and the Description line shows RETAIL channel or OEM channel.
  3. You can also open Settings → System → Activation (Windows 11) or Settings → Update & Security → Activation (Windows 10). It should say Windows is activated.

If you entered a Pro key on a Home install, Windows asks to restart. After the restart, About shows Windows 11 Pro (or Windows 10 Pro).

Useful slmgr commands

CommandWhat it does
slmgr /ipk KEYInstalls (or replaces) the product key
slmgr /atoActivates Windows online
slmgr /xprShows whether activation is permanent or when it expires
slmgr /dliShows the license status and the key’s channel (Retail, OEM, Volume)
slmgr /dlvSame as /dli with full details, including the last activation error
slmgr /ckmsClears a KMS server address left by a company or an “activator” tool
slmgr /upkUninstalls the product key (use before moving a key to another PC)
slmgr /cpkyRemoves the key from the registry so it can’t be read back
slui 4Opens phone activation (not an slmgr command, but the offline route)

Common errors when activating with CMD

  • 0xC004F050 – “the product key is invalid”: usually a typo, or a key for a different edition. Check the edition in About and retype the key. Full fix for 0xC004F050 →
  • 0xC004C008 – “already in use on another device”: the key is still active on another PC. Run slmgr /upk on the old PC, then /ipk and /ato on the new one. Full fix for 0xC004C008 →
  • 0xC004F074 – “can’t connect to your organization’s activation server”: Windows still points at a KMS server. Run slmgr /ckms, then /ipk and /ato again. Full fix for 0xC004F074 →
  • 0xC004C060 – “the product key has been blocked”: the key was revoked by Microsoft. Contact the seller for a replacement. Full fix for 0xC004C060 →
  • 0x8007007B – “DNS name does not exist”: the key is a volume key, or the PC looks for a KMS server. Full fix for 0x8007007B →
  • “Access denied” or nothing happens: Command Prompt isn’t running as administrator. Go back to Step 1.
  • Online activation keeps failing: press Windows + R, type slui 4, pick your country and follow the automated phone activation.

Need a genuine key to activate with?

A retail Windows key activates directly with Microsoft, works with these commands, and can be moved to a new PC later.

  • ✔ Instant email delivery
  • ✔ Online activation, no phone call needed
  • ✔ Free support if activation doesn’t work


Get Windows 11 Pro Key

Frequently asked questions

Does slmgr work on Windows 11?

Yes. The commands are identical on Windows 10 and Windows 11. Only the Settings path for checking the result is different (System → Activation on Windows 11).

Yes. slmgr is Microsoft’s own tool, built into Windows, and it does exactly what the Settings page does. What matters is the key: use a genuine retail or OEM key. “Activator” scripts that fake a KMS server are a different thing and cause errors like 0xC004F074 later.

Can I activate Windows with CMD without a product key?

No. slmgr needs a valid key to activate. If your PC was activated before with a digital license linked to your Microsoft account, sign in with that account and use Settings → Activation → Troubleshoot instead.

Do I need to restart after slmgr /ato?

Not for activation itself. You only need a restart if the key changed your edition, for example from Home to Pro.

Will these commands delete my files?

No. slmgr only changes the license information. Your files, apps and settings stay where they are.

How do I move my key to a new PC?

On the old PC run slmgr /upk and slmgr /cpky. On the new PC run slmgr /ipk YOUR-KEY and slmgr /ato. Retail keys can be moved; OEM keys stay with the original PC.