Still sometimes need to use batch files to do stuff even in this day and age? Yes, is the usual answer but, unfortunately many of the standard errorlevel checking tools such as CHOICE etc. have either been removed or cannot be used without administrator access in Enterprise environments.

It’s not always entirely wise either to install compiled errorlevel tools into an Enterprise environment. This will potentially go against an application or network policy or you’re just plain unable to.

The below batch file instead is self-contained outputting a DEBUG script before compiling it and utilising it to check for user input. This it utilises within the demo. Save the text down to a textfile and give it the extension .bat

It is an extension of and use of the following Microsoft support site example - Accepting Keyboard Input in Batch Files. Note that there should be a backslash after %temp% and before the word REPLY which is being stripped out by this parser.

  • Share/Bookmark