Change Password Using CMD: Command Line Access Management

Change a Windows password using CMD

Most people change a Windows password through Settings, but there’s a faster route that IT pros reach for every day: a single command. Changing a password from the Command Prompt is quick, scriptable, and handy when the usual menus are slow or unavailable. We at GetMyPassword show you exactly how, including the privacy trick that keeps your new password off the screen and the one requirement that trips people up.

Change a Windows password with net user
Changing a Windows password with the net user command.

Open Command Prompt as administrator

This is the step everyone forgets — and without it the command fails. Type cmd into the Start menu, right-click Command Prompt, and choose Run as administrator. A standard user account can’t change the password for other accounts, so the admin prompt is essential.

Change the password with net user

  1. Type net user and press Enter to list every account on the PC.
  2. Run net user username newpassword, replacing username with the account name and newpassword with the password you want.
  3. Press Enter — you’ll see “The command completed successfully.”

If the account name has a space in it, wrap it in quotes: net user "John Smith" newpassword.

Keep the password off the screen

Typing a password in plain text where someone could read it isn’t ideal. For privacy, replace the password with an asterisk: net user username *. Windows then prompts you to type the new password twice, hidden from view. It’s a small change that makes the command far safer to use over someone’s shoulder.

An “Access denied” message almost always means the Command Prompt wasn’t opened as administrator. Close it, reopen with Run as administrator, and try again.

A note for Microsoft accounts

The net user command works on local Windows accounts. If you sign in with a Microsoft account, its password lives online, so you change it at account.microsoft.com rather than in CMD. Not sure which you have? If you log in with an email address, it’s a Microsoft account.

Choose a strong replacement

The command makes it easy to set any password — so make it a good one rather than something memorable-but-weak. Generate a long, random password with our password generator and confirm its strength with the strength checker before you set it. For the reasoning behind what counts as strong, see our guide on what makes a strong password.

Frequently asked questions

How do I change a Windows password using CMD?

Open Command Prompt as administrator, type net user to list accounts, then run net user username newpassword. Press Enter and you’ll see a success message.

Why do I get “Access denied” with net user?

You didn’t open Command Prompt as administrator. Standard accounts can’t change other users’ passwords, so reopen it with Run as administrator.

Can I change a Microsoft account password with CMD?

No. The net user command only works on local accounts. A Microsoft account password is stored online and must be changed at account.microsoft.com.

Help your friends stay safe. Share this article!