Page 1 of 1

MakeCmdHelp.bat/CmdHelp.bat: Menu-driven help for cmd.exe commands

Posted: 05 Dec 2016 13:38
by Aacini
I started to write this program as an example of the applications that could be developed with my GetInput.exe auxiliary program, using its standard user interface via both keyboard and mouse input. However, when the first version was completed I didn't liked the feel of the program. Then, I developed the SendMessage.exe auxiliary program with the main purpose of provide a better user experience to this Batch program, and this time the result was very satisfactory.

MakeCmdHelp.bat program create a menu that organizes the help on cmd.exe commands in a two-level menu, easy to browse. The commands for the menu are taken from the help command itself: first, the help command is executed with no parameters in order to get the list of commands to include; then, the help command is executed again with each command in the list in order to accomodate the output in the best way. This program just needs a series of values that define the divisions in the menu and the commands that will be included in each one, so the menu is easily customizable. Finally, all this data is stored in a menu-definition text file.

After that, CmdHelp.bat program is used to read such information, show a very attractive menu and navigate it. The result is a very fast help system that include precisely the commands available in the target computer with descriptions written in the local language. Pretty cool! 8)

Image

I tuned-up these programs in my Windows 8.1 Spanish computer, adjusting the output of help command because in this case the appearance is very important. However, I don't know if the output in other versions/languages may be different in these points. I marked with uppercase REM commands those parts in the code that deals with these formatting details: the number of "header" and "footer" (non-command) lines and the number of columns that the command name occupy in the output of HELP (no argument) command. If the menu pages shown in your computer are not perfect, you may adjust just these four lines in MakeCmdHelp.bat program.

Also, the vertical size of the cmd.exe screen buffer must be large enough to receive the largest help output plus 15 lines. In my Windows version the command with the largest help is ROBOCOPY that requires a total of 230 lines, so I adjusted the cmd.exe window properties to a buffer height of 250 lines. Anyway, you may make a better use of a large buffer now via the SendMessage.exe auxiliary program. As a bonus, I included the S.bat file that allows you to scroll the screen contents using the standard navigation keys.

CmdHelp.bat program requires ColorChar.exe, CursorPos.exe, GetInput.exe and SendMessage.exe auxiliary programs, but all of them are included in the .zip file.
CmdHelp.zip
MakeCmdHelp.bat, CmdHelp.bat and the auxiliary .exe programs required
(8.57 KiB) Downloaded 1175 times

Note: the GetInput.exe program in this .zip file is an updated version that now allows to include several groups of intermixed "chars" and keycodes, that is a new feature used in CmdHelp.bat program. The .zip file in the auxiliary .exe programs thread have now the updated version, but if you had previously downloaded such a file, you must be aware that you must delete your old GetInput.exe file.

Antonio