When Command Prompt Works for Password Resets
Command Prompt can reset a Windows password only if you can still log into the computer with a different account that has administrator rights. If you are locked out completely — meaning you cannot log in as anyone — Command Prompt will not help you. This method works when a family member, colleague, or you yourself have access to another admin account on the same machine.
The most common scenario is a household where one person knows the admin password and another person has forgotten their own password. Command Prompt lets the admin account reset that other password without erasing files or reinstalling Windows. The entire process takes less than two minutes once you open the right window.
Key Takeaways
- You must be logged in as an administrator to use Command Prompt to reset another account's password.
- The command net user [username] [newpassword] changes a password in seconds if you know the account name.
- If you do not know the exact account name, type net user alone to see all accounts on the computer.
- This method works only on local accounts, not on Microsoft accounts linked to an email address.
- After resetting the password, the person logs in with the new password you created, then changes it to something only they know.
Opening Command Prompt as Administrator
Click the Windows Start button and type cmd into the search box. Right-click on "Command Prompt" when it appears in the results, then select "Run as administrator." Windows will ask for permission — click "Yes" to continue. A black window with white text will open.
If you see a message saying "Access Denied" when you try the next steps, you are not running as administrator. Close this window and repeat the process, making sure to right-click and select "Run as administrator." The administrator label matters — running Command Prompt normally will not give you the power to change passwords.
Finding the Correct Account Name
Type net user and press Enter. The computer will display a list of every account on the machine. Look for the account name you need to reset — it will be exactly as it appears in this list, sometimes with spaces or numbers you might not expect.
Write down the exact account name as it appears. If the account is called "John Smith" in the list, you must type "John Smith" (with the space) in the next step. If you type it wrong, the command will fail and you will see an error message.
Resetting the Password
Type net user John Smith NewPassword123, replacing "John Smith" with the actual account name and "NewPassword123" with a new password you choose. Press Enter. The computer will respond with "The command completed successfully" if it worked.
The new password takes effect when ready. The person who owns that account can now log in using the new password you just created. They should log in, then go to Settings > Accounts > Sign-in options and change the password to something only they know.
Passwords with Spaces or Special Characters
If the new password contains spaces, put the entire password in quotation marks. For example: net user John Smith "My New Password". Without the quotation marks, the computer will only use the first word as the password.
Special characters like exclamation marks, dollar signs, and ampersands are allowed. However, the simpler you keep the password, the less likely the person will mistype it when logging in. A password like "Winter2024Blue" is easier to enter correctly than "P@$$w0rd!#2024".
What to Do If the Command Does Not Work
If you see "The system cannot find the file specified," you are not in the right location or Command Prompt did not open correctly. Close the window and try opening Command Prompt as administrator again. Make sure you right-click on "Command Prompt" in the search results — left-clicking will not give you the administrator access you need.
If you see "Access Denied," the account you are logged in with does not have administrator rights. Only an administrator can reset another account's password. Ask whoever set up the computer to do this step, or log out and log in with a different account that has admin rights.
If you see "The user name could not be found," the account name you typed does not match exactly. Run net user again and copy the name exactly as it appears, including any spaces or numbers. Account names are case-sensitive in some situations, so match the capitalization as well.
Resetting Your Own Password If You Are the Administrator
If you are the only administrator and you forgot your own password, Command Prompt cannot help — you cannot log in to run it. You will need to use a password reset disk if you created one before, or use another method like a Microsoft account recovery or a Windows installation disk.
Contact Microsoft Support or visit their account recovery page for those options. If you have a second computer with administrator access to this one, you may be able to reset your password remotely, but that requires setup before you are locked out.
Frequently Asked Questions
Can I reset a password if I do not know the account name?
Yes. Type net user by itself to see all account names on the computer. Find the one you need and use the exact spelling, including spaces and numbers.
Will resetting the password delete the person's files?
No. Resetting a password through Command Prompt leaves all files, photos, documents, and programs exactly where they are. Only the password changes.
What if the account is a Microsoft account, not a local account?
The net user command works only on local accounts. If the account is linked to an email address (a Microsoft account), you cannot reset it this way. The person will need to use the "I forgot my password" option on the Windows login screen instead.
Can the person whose password I reset see that I changed it?
No. Windows does not keep a log of password changes visible to the account owner. However, they will know because they cannot log in with their old password anymore.
Is it safe to create a temporary password and have them change it later?
Yes, that is the recommended approach. Create a straightforward temporary password, they log in, then they when ready change it to something only they know. This way you never know their actual password.