Use net user username /delete in an elevated Command Prompt for a local Windows account; it will not remove a Microsoft account from the cloud or a domain account from Active Directory. Using the wrong path can lock you out, leave the profile behind, or remove the wrong user. This guide shows the safest Command Prompt path for local admin and standard accounts, plus when CMD is the wrong tool for Microsoft-linked and domain accounts.
What this guide covers
This guide sorts the account type first, because the correct deletion path depends on whether Windows stores the account only on the PC, links it to a Microsoft sign-in, or manages it through a domain. That difference decides whether cmd.exe can delete the account, or whether you need Windows Settings > Accounts or domain admin tools instead.
Command Prompt can open from Start search by typing “Command Prompt,” or from Run with Win + R and cmd. For account changes, open it with administrator access; some tasks may fail without elevation, especially when the user being removed has protected access or when the machine enforces policy.
📊 On Windows 10 and 11, right-clicking the Windows icon can show PowerShell or Terminal instead of Command Prompt. Source: Wikihow.
What you'll need
- An administrator account on the same PC.
- The exact username you want to remove.
- A second admin account to sign in with after deletion.
- Access to Command Prompt (cmd.exe) opened with administrator rights.
- Access to Windows Settings > Accounts if cmd is not the right tool.
- A backup of any files you want from
C:\Users\username.
Can Command Prompt delete every account?
No. net user can delete a local Windows account, but it cannot fully remove every Microsoft account or domain account from a plain local Command Prompt window. Start by identifying the account type, then use the safest path for that type instead of forcing a command that only applies to local users.
| Account type | Can Command Prompt delete it? | Exact command or alternative path | Required privileges | Most common failure message |
|---|---|---|---|---|
| Local account | Yes | net user username /delete |
Administrator access in an elevated Command Prompt | The user name could not be found. |
| Administrator account | Sometimes, if it is a local admin | net user username /delete; sign in with another admin first |
Another administrator account; elevation required | Access is denied. |
| Microsoft account | Not fully, in most cases | Windows Settings > Accounts or Microsoft account sign-in settings; remove the device sign-in there | Admin access on the device; account sign-in access may be needed | This action is not allowed for this account type. |
| Domain account | No, not from a local PC cmd window alone | Domain admin tools or Active Directory management on the domain controller | Domain administrator rights | The system cannot find the domain specified. |
How do I delete a user account from Command Prompt?
Use net user username /delete in an elevated Command Prompt, but only for a local account. The command removes the account entry from the machine; it does not clean every file in C:\Users, and it does not replace Windows account removal screens for Microsoft-linked or domain accounts.
- Open Command Prompt. Search for “Command Prompt” from Start, or press
Win + R, typecmd, and press Enter. Open it as administrator for account changes. - Confirm the username. Run
net userand copy the exact local account name you want to remove. - Delete the account. Run
net user username /delete, replacingusernamewith the exact account name. - Check for a leftover profile. Open
C:\Usersand verify whether the folder remains. If it does, clean it separately after you confirm the account is gone.
Suppose the account name is alex and the delete command returns “The user name could not be found.” That usually means the name is wrong, the account is not local, or you typed the display name instead of the logon name. Re-run net user and use the exact entry shown there.
Delete a local account from cmd
For a local account, cmd is the safest direct deletion path. The account exists only on that PC, so net user username /delete removes the sign-in without needing Microsoft account web steps. Still, the profile folder in C:\Users may remain, and that is a separate cleanup task.
- Open elevated cmd. Use administrator access before running any deletion command.
- Run the delete command. Type
net user username /deleteand press Enter. - Recheck the account list. Run
net useragain to confirm the name no longer appears. - Inspect the profile folder. If
C:\Users\usernamestill exists, remove it only after confirming no needed files remain inside.
What if cmd is the wrong tool?
Use Windows Settings > Accounts when the account is Microsoft-linked, work-connected, school-connected, or otherwise managed outside the local machine. A local cmd window cannot always fully remove those sign-ins, and forcing net user can produce an access or account-type error instead of deleting the real sign-in.
- Open account settings. Go to Settings > Accounts.
- Choose the right area. Use Email & accounts, Access work or school, or Family & other users, depending on the account type.
- Remove from Windows first. Delete the local device association there before trying any command-line cleanup.
- Finish the web step if needed. For a Microsoft account, remove or close the online account through Microsoft account settings if the goal is full account closure.
Picture a Windows 11 PC where the sign-in uses an email address, not a local username. Running net user may show a similar-looking local name, but deleting that local entry will not remove the online Microsoft sign-in itself. In that case, Settings is the correct path.
Common mistakes
The biggest mistakes are deleting the wrong name, using a non-elevated Command Prompt, and assuming the user profile folder will vanish automatically. Another common miss is treating a Microsoft account or domain account like a local account. Those are different account types and need different removal paths.
- Using the display name. Always copy the exact logon name from
net user. - Skipping elevation. Open cmd as administrator for account changes that affect protected users.
- Deleting the only admin. Sign in with another administrator first.
- Ignoring leftovers. Check
C:\Usersfor the profile folder and any permissions that still point to the old account. - Expecting cloud removal from cmd. Microsoft account cleanup often needs Settings or web account steps.
What happens if I delete the wrong user account from cmd?
You can remove a valid local account and lose access to that user’s files, desktop settings, and sign-in. If the account was the only administrator, you may also lose the easiest recovery path. Stop immediately, sign in with another admin account, and check C:\Users before doing any cleanup.
If the wrong account was a local account, you may be able to recreate a user with the same name, but its old settings will not come back automatically. If it was a Microsoft account or domain account, the correction usually starts in Settings > Accounts or with domain admin tools, not another net user command.
Frequently asked questions
How do I remove a local account using cmd?
Open an elevated Command Prompt and run net user username /delete. Then run net user again to confirm the account is gone. If C:\Users\username is still present, remove the leftover profile separately after you verify the files are no longer needed.
What is the net user command to delete an account?
The delete syntax is net user username /delete. Replace username with the exact local account name from net user. If the command returns “The user name could not be found,” check for a typo or confirm that the account is local, not Microsoft-linked.
Do I need admin rights to delete an account from Command Prompt?
Yes. Open Command Prompt with administrator access before running account changes. Without elevation, net user username /delete may fail with access errors, especially if the target account is protected or if Windows requires higher privileges for local account management.
How do I delete an administrator account in cmd?
If it is a local administrator account, sign in with a different admin, open elevated Command Prompt, and run net user username /delete. If it is the only admin on the PC, create or sign in with another administrator first so you do not block recovery access.
Can I delete a Microsoft account with Command Prompt?
Not fully, in most cases. Use Settings > Accounts to remove the device association, then complete any online Microsoft account steps separately if you want full closure. A plain local cmd window is not the right tool for the cloud side of that sign-in.
How do I delete a domain account with Command Prompt?
Use domain management tools from a domain admin context, not a local PC Command Prompt. A local machine cannot remove an Active Directory account by itself. If you are on a joined PC, ask the domain administrator or use the domain controller’s management console.