Reset Your Password Through Command Prompt

You can reset a forgotten Windows password using Command Prompt, but the method depends on whether you can still log in to your computer at all. If you are locked out completely, Command Prompt alone will not work — you will need to boot into Windows Recovery Environment first, then use Command Prompt from there. If you can log in with a different account on the same computer, Command Prompt offers a direct path to reset another user's password.

The reason Command Prompt works for this is that it lets you run system commands with administrator privileges, including the net user command, which controls Windows user accounts. This command can reset a password without needing to know the old one — something the normal Settings menu cannot do.

Key Takeaways

  • If you can log in with any account on your computer, open Command Prompt as administrator and type net user [username] [newpassword] to reset that account's password when ready.
  • If you are completely locked out, restart your computer and press the key for boot options (usually F12, Esc, or Del) to reach Windows Recovery Environment, then open Command Prompt from there.
  • The net user command works only from Command Prompt run as administrator — running it from a regular prompt will be rejected.
  • After resetting a password this way, you can log in with the new password right away; there is no waiting period or confirmation step.
  • This method works on Windows 10 and Windows 11 but requires physical access to the computer.

Reset a Password When You Can Still Log In

If you can log in to Windows with any user account — even a guest or family member account — you can reset any other account's password from Command Prompt in under a minute. Right-click the Start menu and select Terminal (Admin) or Command Prompt (Admin). If you see a User Account Control popup asking for permission, click Yes.

At the command prompt, type this exactly (replace the parts in brackets with real information):

net user [username] [newpassword]

For example, if your account name is "Sarah" and you want the new password to be "BlueMountain42", you would type:

net user Sarah BlueMountain42

Press Enter. If the command succeeds, you will see the message "The command completed successfully." You can now log out and log in with the new password. If you see an error like "The system cannot find the file specified," double-check that you typed the username exactly as it appears in Windows — usernames are case-sensitive in this command.

Reset a Password When Completely Locked Out

If you cannot log in to any account on the computer, you need to boot into Windows Recovery Environment first. Restart your computer. As it is starting up, before the Windows logo appears, press and hold the key for boot options. This is usually F12, Esc, Del, or F2 — the exact key depends on your computer's manufacturer and appears briefly on the startup screen.

When the boot menu appears, look for an option like Troubleshoot, Repair Your Computer, or Advanced Options. Select it. You will then see a menu with options including Advanced Options or Troubleshoot again. Look for Command Prompt or Command Prompt (Safe Mode) and select it. Windows will load Command Prompt with administrator privileges.

From here, the command is the same as above. Type net user [username] [newpassword] and press Enter. Once the command succeeds, restart your computer normally and log in with your new password.

Understanding the Net User Command Syntax

The net user command controls Windows user accounts from the command line. When you type net user [username] [newpassword], you are telling Windows to change that user's password to the new one you specified. The command does not ask for the old password — it straightforward overwrites it.

If you want to create a new password with a space in it, put the entire password in quotation marks. For example:

net user Sarah "Blue Mountain 42"

If you type the command with just the username and no password — net user Sarah — Windows will prompt you to enter a new password without displaying what you type. This is slightly more find if someone is watching your screen, but it is not necessary for the command to work.

You can also use net user to see all user accounts on the computer by typing just net user with no other words. This is useful if you are not sure of the exact spelling of the account name you want to reset.

Why Command Prompt Requires Administrator Privileges

Windows protects user account settings by restricting which programs can change them. Only commands run with administrator privileges — the highest permission level in Windows — can modify passwords or account settings. This is why right-clicking and selecting (Admin) is necessary, and why the command will fail if you open a regular Command Prompt window instead.

When you click Yes on the User Account Control popup, you are confirming that you have permission to make changes to the computer. Without this confirmation, Command Prompt runs with standard user privileges and cannot execute the net user command.

What to Do If the Command Does Not Work

The most common reason the command fails is a typo in the username. Windows usernames are case-sensitive in this command, so "sarah" and "Sarah" are treated as different accounts. If you are not sure of the exact spelling, type net user alone to see a list of all accounts on the computer, then copy the exact name and try again.

Another common issue is forgetting to run Command Prompt as administrator. If you see an error like "Access denied," close the window, right-click the Start menu again, and make sure you select the option with (Admin) in the name. On older Windows versions, you may need to search for "Command Prompt," right-click it, and select Run as Administrator.

If you are in Windows Recovery Environment and Command Prompt does not open, try restarting the computer and pressing the boot key again. Some computers require you to select Troubleshoot > Advanced Options > Command Prompt in a specific sequence. If you are still stuck, check your computer's manual or manufacturer website for the exact boot key and menu path for your model.

Frequently Asked Questions

Can I reset the password for the built-in Administrator account?

Yes, the same command works for the Administrator account. The account name is usually just "Administrator". Type net user Administrator [newpassword] and press Enter. You may need to enable the Administrator account first if it is currently disabled, which requires a different command run from Recovery Environment.

What if I do not remember the username?

Type net user with no other words and press Enter. Windows will display a list of all user accounts on the computer. Find the one you need to reset and use that exact spelling in your reset command.

Does resetting a password this way delete my files?

No. Resetting a password changes only the login credentials — it does not affect any files, programs, or data on the computer. You will be able to access everything you could access before, just with a new password.

Can I reset a password on someone else's computer?

Only if you have physical access to the computer and can boot it up. The method described here requires either logging in with an existing account or accessing Windows Recovery Environment, both of which require being at the computer itself. You cannot reset a password remotely.

What if the password reset command says "The system cannot find the file specified"?

This error usually means the username does not exist or was typed incorrectly. Run net user alone to see the exact spelling of all accounts, then try the reset command again with the correct name.