Wednesday, September 14, 2011

Creating a New User Account via Batch Files

Q: I need to write a batch file that creates a new user account. The account's name and password should be passed as parameters like batch_file name pass. What should I do?

A:
Start Dr.Batcher and type the following script:

@echo off
if "%~2"=="" goto error
if "%~1"=="" goto error
net user %~1 %~2 /add
goto :EOF
:error
echo Usage: %~0 user password

That's all!

No comments:

Post a Comment

Translate