You can use the "net user" command to add and delete accounts.
Here is a generic batch file that will LOOP:
if NOT DEFINED i goto USAGE
if NOT DEFINED j goto USAGE
set /a j = %i% + %2
@echo start, i = %I% and j = %J%
if %i% GTR %j% goto FINISHED
echo i = %i%
set /a i=%i + 1
@echo finished, i = %I%
@echo Usage : loop.bat [ start # ] [ # of iterations ]
@echo Example : loop.bat 4 5 (this will start at 4 and end at 9)
In the loop you would need to do two things:
- net user /delete user%I%
- net user /add user%I% (with more options)
You can modifiy the batch file to take a third argument which could be the password that is then passed on to the "net user /add" command.
Use "net help user" to get more information on how to use the command.