|
Answer» I have a batch file and it waits for the user to write what to do, but I want it to echo something if the user didn't respond after 10 seconds.
This is what I have so far:
Code: [Select]@echo off title EXAMPLE :firstcommand echo WAITING for command: set /p command1= if /I %command1%==go echo thanks. pause >nul If it is possible please post an example Code: [Select]@echo off title Text Wait :NCA cls echo The Command resets after 10 seconds. echo. CHOICE /C:12 /N /T:2,10 Enter Command? 1 for yes. 2 for no. if %errorlevel% equ 1 GOTO EC if %errorlevel% equ 2 Goto NCB
:EC cls echo.Command? set /p cmnd= if /I '%cmnd%'=='test' ( cls echo This works! pause exit ) rem Enter rest of code here. rem Make sure there is an exit or goto rem that keeps the batch program from going rem to the NCB label.
:NCB cls Echo A command wasn't entered. pause goto NCA try this, this uses the choice command(you'll have to download the NT version of it and place it in your System32 folder) it waits 10 seconds and then echo's that a command wasnt entered.
hope this works for you ,NickWorked great! your welcome
|