Skip to content

How to Add or Delete User Accounts Using Batch Files in Windows 7?

By Codrut Nistor

Posted in How-to, Windows-7

Batch files are considered as one of the best tools to automate any process. They enable administrators to get rid of tedious repeated clicks on same interface several times in a day. An example can be if an administrator wants to create 50 user accounts on a computer he has to go to Control Panel and has to go through the user creation wizard for 50 times. This practice might be quite time consuming and boring. However with help of batch file he can type few commands to create user accounts and can run the file. This would create 50 user accounts within few minutes. Also if required this batch file can be used to create 50 more users within a fraction of seconds. You can create a batch file to automate the process of user account creation by following the instructions given below:

  1. Click on Start button.
  2. At the bottom of start menu in search box type Notepad and press enter key.
  3. In the notepad type command NET USER USER1 123 /ADD where USER1 is the user name that you want to create and 123 is the password for the user account. If you want to create 50 users at a time you can simply copy the entire command and can paste it 50 times on the same notepad and change the user names as per your requirements like USER1 USER2 USER3.. and so on.
  4. Once you are done with commands you can save the notepad file with .BAT extension. For example CREATEUSER.BAT. Make sure you specify the file name and extension between " ".
  5. To create these 50 users in a single go you just need to right-click on the batch file that you have created and select Run as Administrator option. A command window will be popped up for a few seconds and and you are done.
  6. You can check the created user accounts by going to Control Panel.
  7. If you want to delete user accounts you can use the same method but use "/del" instead of "/add" and do not provide password. For example if you want to delete User1 you can type NET USER USER1 /DEL.