Menus for .BAT files
 

One of best-established ways of automating processes on a computer is the BAT file, which has been around since 1981, and is available on a Windows PC using the Command Line Interface. The excellent site https://ss64.com/ provides a rich source of information about the Windows command line.

My "BatMenu" utility aims to enhance user interaction with a BAT file, by presenting a multiple choice menu. The software presents the options as a list with one option highlighted; the user navigates with the <up-arrow> and <down-arrow> keys, selecting the chosen option by pressing <enter>. A simple text file is passed to the "BatMenu" program to determine the choices presented to the user. Associated with each choice is a number, and the number associated with the chosen option is written to a result file. The contents of the result file can then be used to determine subsequent processing. All of this is illustrated in the accompanying files test.bat and menu1.txt.

The software expects to use a folder called "Pearbright" in your "My Documents" directory; if this does not exist it will be created. Place all the files in this folder.

Your computer will probably warn you not to run BatMenu and you should scan the file to ensure that it contains no malware. If you are happy to proceed, right click BatMenu.exe and set its properties to prevent it being blocked by Windows Defender, or create an exclusion for your anti-virus software.

The menu files may be created using notepad and should use UTF-8 encoding, but the result file must use ASCII encoding to work with the SET /P command.

You may find it helpful to execute the BAT file from a shortcut in order to increase the font size.

Download the software here: batmenu.zip.

 

© Peter Talbot 2020 - 2024 all rights reserved