I am making this batch file like this:
:COMMANDPRO
set /p "command=C:\> "
if %command%==net user shutdown goto SHUTDOWN
echo Command not recognised...
goto COMMANDPRO
It doesn't work because I can't have any spaces in the IF statement. For it to work, I would have to type in netussershutdown but I want to type "net user shutdown"! Any ideas how I could make this work WITH spaces in the variable???
Variable space
Moderator: DosItHelp
Re: Variable space
Code: Select all
if /i "%command%" == "net user shutdown" goto SHUTDOWN
Edit: You might want to use the /i switch. It makes IF statements (and lots of other commands) case insensitive.
Last edited by Fawers on 20 Apr 2012 17:28, edited 1 time in total.