KB

Asking a Question in a Batch Script

Sometimes you want to ask a question in a batch script, and do something based upon the response. You can use the set command and an if statement to achieve this:

set RESPONSE=
echo Read backup log? (y/n)
set /p RESPONSE=
if /i (%RESPONSE%)==(y) notepad Backup.log