Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
Computer Hope forum e-mail issues and down time
0 Members and 1 Guest are viewing this topic.
@echo off@echo select number@echo.echo 1.shutdownecho 2.restartecho 3.logoffecho 4.sleepecho 5.lock@echo.set/p ch="your choise >"if %ch%==1 goto shutdownif %ch%==2 goto restartif %ch%==3 goto logoffif %ch%==4 goto sleepif %ch%==5 goto lock:shutdownShutdown.exe -s -t 00:restartShutdown.exe -r -t 00:logoffShutdown.exe -l:sleeprundll32.exe powrprof.dll,SetSuspendState 0,1,0:lockRundll32.exe User32.dll,LockWorkStation
it's complicated to ensue user's legal input when using set /p command.
:loopset/p ch="Your choice [1,2,3,4 or 5] >"if "%ch%"=="1" goto shutdownif "%ch%"=="2" goto restartif "%ch%"=="3" goto logoffif "%ch%"=="4" goto sleepif "%ch%"=="5" goto lockecho.echo Enter 1,2,3,4 or 5 only!echo.goto loop
No it isn't. At least not in this case.
Yes, I agree. We do have method to filter the input. But not your code. Did you tried input only a double quotation mark "
I use a batch file to start up a few of the programs I need running in the background. Up until now, I had used the pause command to execute it after some of the other start-ups finished. I would prefer to use the wait or sleep commands but they do not appear to be included in Windows 7.Anybody know how to put those commands back in, or a different method that achieves the same results?