I need a batch command

May 25, 2011 at 15:54:37
Specs: Windows XP
i am very new to all of this DOS stuff.I really only know like 1 command which is the password change ( net user "your user" *) just for learning purposes is there anyway that i could just run a batch file and it would automatically run that code?

For example: instead of me having to type in
net user owner *
then the password
password again

couldn't I just open a batch file that does that all in one click?
I'm not sure if this is possible but I thought i would ask.
Thanks in advance :P


See More: I need a batch command

Report •


#1
May 25, 2011 at 18:51:49
BEGIN --

@echo off
REM Here, you have to enter username and password
:loop1
set /p usr="Enter username: "
set /p pass="Enter password: "

REM Set new password for the given username
net user %usr% %pass%
if errorlevel==2 goto error
goto success

:error
REM On any error, print error message and return to loop1
echo Could not change password for user %usr% !!!
if errorlevel==2 goto quit
if errorlevel==1 goto loop1

:quit
REM Print error message on screen and stop program
echo Program stopped. No password has been changed.
echo Restart passwd, to try again.
goto end

:success
REM End program on success
echo Password for user %usr% has been changed successfully.

:end

END ---

Copy and past text between BEGIN --- and END --- and save it as e.g. passwd.bat

Hope that helps.

Click Here on HowTo ask good Question to get best Help
Let us know, if the problem is solved !!!


Report •

#2
May 25, 2011 at 19:38:42
Thank you very much that works quite well :D

Report •

#3
May 25, 2011 at 20:10:48
You are welcome.

Click Here on HowTo ask good Question to get best Help
Let us know, if the problem is solved !!!


Report •
Related Solutions


Ask Question