windows - Batch File Choice Command Loops -



windows - Batch File Choice Command Loops -

i've written simple batch file selection command. code follows:

choice /c yn /m /t 5 "do want continue" if errorlevel 2 goto no if errorlevel 1 goto yes goto end :no echo selected no goto end :yes echo selected yes :end

problem when run it doesn't wait input .. loops through , doesn't stop. don't know or why doesn't work. created batch file @ work selection command more complex , works fine. file wouldn't work on computer either.

also if type selection command straight in cmd works fine batch file loops

any suggestions? thanks

here link video shows doing http://youtu.be/4tkwlr7ymb8

the /m switch message, need write text after /m. need include /d switch (for default), because specified how long have create selection /t. default alternative option selected automatically if user doesn't create selection in, example, 5 seconds. below illustration automatically take n @ end of time.

choice /c yn /d n /t 5 /m "do want continue"

the name of batch file must not same command used within batch file. when create phone call executable (i.e. choice), cmd in current directory file of name before looking @ directories in path variable. so, because batch file called choice.bat, when run command choice /c ... making phone call batch file itself, , not choice command. re-name batch file.

windows batch-file cmd command choice

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -