sodcalculator

10 Tech How-To

Reset Local Account Password Using CMD

Guide 10-22212 · Updated · Step by step

This guide shows you how to reset a forgotten local Windows account password using Command Prompt. It works for local accounts (not Microsoft accounts) on Windows 10 and 11, and you’ll need access to another admin account or a recovery environment to get started.

What You’ll Need

  • A Windows PC with a local account (not a Microsoft account)
  • Another administrator account on the same PC, OR a Windows installation USB drive
  • Basic comfort with typing commands

Step-by-Step

Method 1: From Another Admin Account

  1. Log in to the PC using an administrator account that you know the password for.
  2. Press Windows Key + R, type cmd, then press Ctrl+Shift+Enter to open Command Prompt as administrator. Click Yes if prompted by User Account Control.
  3. Type net user and press Enter. This lists all local user accounts on the PC. Note the exact username of the account you need to reset.
  4. To reset the password, type the following command and press Enter:
    net user [username] [newpassword]
    Replace [username] with the actual username and [newpassword] with the new password you want. For example: net user John P@ssw0rd
  5. If successful, you’ll see The command completed successfully.
  6. Log out and log in with the new password.

Method 2: Using a Windows Installation USB (If You Don’t Have Another Admin Account)

  1. Create a Windows installation USB drive using the Microsoft Media Creation Tool on another PC.
  2. Insert the USB into the locked PC and boot from it (you may need to press a key like F12 or Del during startup to select the boot device).
  3. On the Windows Setup screen, press Shift+F10 to open Command Prompt.
  4. Type regedit and press Enter to open Registry Editor.
  5. In Registry Editor, click on HKEY_LOCAL_MACHINE to select it.
  6. Click File > Load Hive.
  7. Navigate to the Windows\System32\config folder on your system drive (usually C:). Select the file named SYSTEM and click Open.
  8. When prompted for a key name, type temp and click OK.
  9. Navigate to HKEY_LOCAL_MACHINE\temp\Setup. You’ll see a value named CmdLine on the right. Double-click it and change its value to cmd.exe. Click OK.
  10. Also find a value named SetupType. Double-click it and change its value to 2. Click OK.
  11. Go back to HKEY_LOCAL_MACHINE\temp and click File > Unload Hive. Confirm when asked.
  12. Close Registry Editor and Command Prompt, then restart the PC normally (remove the USB when it starts to boot from the hard drive).
  13. Before Windows fully loads, a Command Prompt window should appear. Now type net user to see the accounts, then use the same net user [username] [newpassword] command to reset the password.
  14. Close the Command Prompt and log in with the new password.

Common Mistakes

  • Using the wrong username: Make sure you type the exact username from the net user list. Usernames are case-insensitive but must be spelled correctly.
  • Not running Command Prompt as administrator: If you get “Access denied” or “System error 5”, you’re not running as admin. In Method 1, you must right-click and choose “Run as administrator”.
  • Typing spaces in the password without quotes: If your new password contains spaces, enclose it in quotes, like net user John "My New Password".
  • Using this on a Microsoft account: This method only works for local accounts. For Microsoft accounts, you must reset the password online at account.microsoft.com.
  • Forgetting to unload the hive in Method 2: If you skip this step, Windows may not boot correctly. Always unload before restarting.

Tips

  • After resetting, consider setting a password hint or using a password manager so you don’t forget it again.
  • If you want to remove the password entirely, you can type net user [username] "" (with empty quotes) to set a blank password.
  • Write down the new password somewhere safe, or store it in a password manager.
  • If you’re resetting for someone else, make sure you have their permission and that they know the new password.

Troubleshooting

  • “The user name could not be found” error: Double-check the spelling. Run net user again to see the exact list. Also ensure you’re not including extra spaces.
  • “Access is denied” error: You are not running Command Prompt as administrator. In Method 1, right-click Command Prompt and select “Run as administrator”. In Method 2, you should already have admin privileges in the recovery environment.
  • Command Prompt doesn’t open in Method 2: Make sure you press Shift+F10 at the right time (usually on the first screen after booting from USB). If it doesn’t work, try pressing Shift+Fn+F10 on some laptops.
  • Windows won’t boot after Method 2: This usually means you didn’t unload the hive or you changed the wrong values. Boot from the USB again, open Command Prompt, and reverse the changes (set CmdLine back to empty and SetupType back to 0).
  • Password reset works but you can’t log in: Make sure Caps Lock is off and you’re typing the password exactly as set. If you used quotes, the quotes are not part of the password.

Frequently Asked Questions

Does this work for Microsoft accounts?

No. Microsoft accounts are tied to online credentials, and the local net user command won’t change them. You’ll need to reset your Microsoft account password online.

Will I lose any files or programs?

No. Resetting the password does not delete any files, documents, or installed programs. It only changes the login credential.

Can I reset the password without an admin account or USB?

If you don’t have another admin account and no USB drive, you may need to reinstall Windows or use third-party recovery tools, which are outside the scope of this guide. It’s always best to have a backup admin account or a password reset disk.

What if I don’t know the exact username?

Run net user in Command Prompt to list all local accounts. The usernames are shown exactly as they appear on the login screen.

Is this method safe? Can it be used for malicious purposes?

This method is a standard Windows recovery feature. It’s safe when used on your own computer or with the owner’s permission. Misusing it to access someone else’s computer without consent is illegal and unethical.

What if I get “System error 5 has occurred”?

This error means you don’t have administrator privileges. In Method 1, reopen Command Prompt with “Run as administrator”. In Method 2, you should already have admin rights in the recovery environment; if not, check that you’re using the correct Windows installation media.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →