editvar and choose
download here: editv30.zip (147,382 bytes; 11 feb 2014)
editvar and choose are designed to allow user input in shell scripts (batch files). the download also includes ms-dos versions of both programs which may be useful on dos bootable media.
editvar works by obtaining the contents of an environment variable and presenting it for interactive editing. if you make any changes to the variable's contents and press enter, editvar writes the changed variable to the parent environment of the program that started it (usually cmd.exe). editv32 requires windows nt 4.0 or later; on windows 9x/me, use the ms-dos version. a 64-bit version (editv64) is also provided.
editvar is similar to the cmd.exe set /p command in windows 2000 and later, but it may be preferable for the following reasons:
- it allows you to edit a variable, not just set one.
- it can limit the length of the typed variable.
- it can mask the typed input for simple password security.
- it can limit typed input to numbers only.
- it offers a timeout feature (useful when a script needs to run unattended).
- it can automatically "escape" reserved shell characters in variables it creates.
- it provides useful exit codes: for example, an exit code of 4 means that the user pressed ctrl-c to abort.
- it comes with an ms-dos version that works in windows 9x/me as well as on ms-dos boot media.
choose is similar to the microsoft choice tool, but it has more features. here are some reasons why it might be preferable to choice:
- it doesn't beep when the user makes an invalid choice.
- it offers a "default key" feature, which lets a user press enter to select a default choice.
- it comes with a real-mode dos version (useful for ms-dos boot media).
- the win32 version's timeout feature doesn't get confused when you run multiple instances in separate console windows (this was a problem with earlier win32 console versions of microsoft's choice tool).
- a 64-bit version is provided.
- it can suppress the display of the user's choice.
- it offers a "line input" mode where the user must press enter after making a choice.