menu
close

Create and Delete Windows 11 User Account From the Command Prompt

We can create and delete user accounts on a Windows PC in multiple methods. The easiest method, I found, is to do it from the Command Prompt. Today, we discuss the creation of a user account with a DOS command.

The second part explains the application of this DOS command in deleting and modifying a Windows user account.



Which DOS Command Can Create a Windows User Account?

You can create a user account directly from Command Prompt by a DOS command Net User.


You need administrative privileges to execute Net User Command.


This command creates a new user account on a Windows computer. This tutorial explains the use of the command net user. Then, we cover the creation of a new user account on a Windows computer from the Command Prompt.

We also check how to modify an existing user account on a Windows computer using the net user command. Let us check the procedure to create a new Windows 11 user account from the Command Prompt.



How to Create a New Windows 11 User From The Command Prompt?

  1. Type Command Prompt on the Windows 11 Search. Click on Run as Administrator.

  2. Type the command in the format below.


    net user (user account name) (password) /add


    Example: net user corenetworkz mypassword /add

  3. Press the Enter key.


    How to Create a Windows User account from Command Line

    See the screenshot. You will get the reply "The command completed successfully" if Windows has created a new account.

Windows has created a new account, and I do not want to keep it. So, I am going to remove that account from my computer. Let us see how to do it from the Command Prompt.



How to Delete a Windows 11 User Account From The Command Prompt?

We can remove an unwanted Windows user account from the command prompt. Follow the steps below.

  1. Open the Command Prompt as the "Run as Administrator" option. Type the net user command in the following format.


    net user username /delete


    Example: I will remove the newly created Windows user account corenetworkz from the Command Prompt. The net user command format to delete the Windows user account corenetworkz is - net user corenetworkz /delete.


    How to Remove a Windows User account

    You can see from the screenshot that I have successfully removed the Windows user account.




The Practical Uses and Syntax of Net User Command

The net user command can create, delete, and edit user accounts on Windows computers. The different syntaxes to create, modify, and delete user accounts from Command Prompt are:



  • To create User Account:   net user Username Password /domain

  • To modify User Account:   net user Username Password /add /domain

  • To Delete User Account:   net user Username /delete /domain

While entering a username from Command Prompt for a new user account, ensure it is a maximum of 20 characters long. While typing the password for the new account, you can use a maximum of 127 characters.




How to Fetch Admin Account Details From Command Prompt?

Another practical use of the net user command is to fetch the complete information about the administrator account on your Windows computer from the command prompt. See how I used the net user command to get the necessary details about the administrator account from Command Prompt.


Net User command

You can see important information like the creation date of the user account, the user's country code, the last date on which the user created the password, the date on which the current password expires, etc. You can also see the last date a user accessed the account. We can also see if there is any login restriction.



The Net User Command Returns Access Denied

Some users reported an error while creating a new Windows user account with the net user command. The error code is 'System error 5 has occurred' with 'access is denied.


System error 5 has occurred

I created this error code to study it properly. The reason for getting an access denied error while creating a new user account is the privileges issues with the DOS Prompt.

You must run the DOS Prompt as an administrator to execute the net user command.