Some friends of mine asked me to provide them one of my scripts that does the following things:

  1. Creates a user account on the local computer.
  2. Creates the user account’s password.
  3. Adds the user to the local administrator group.

First, I will show you the command (or line of code from the script), then break down what each piece performs. Here is the line:

net user USERNAME PASSWORD /add && net localgroup administrators USERNAME /add

This line of code is actually two different commands in one. The double ‘and’ (&&) joins both commands as if it is one. The Windows command line processes each command in order. As you can see, these commands are very straightforward. It uses the built-in and functions from the Windows command line. You can use this in your batch file scripts to perform some administrative tasks regarding local user accounts.