external links: index . projects . home
in-file links: preamble - help - downloads - end
I wanted a simple way to put up a prompt in the console window, wait for a keyboard input, and exit setting the ERRORLEVEL, depending on the keyboard key used ... hence 'ask' ... maybe there is an existing windows command tool to do this, but I have not found it ;=((
My 'ask' application does have a brief HELP, seen by using a /? or -? command ...
Prompt> ask -? Brief Help on Usage - Sep 1 2008 20:19:52 ask [prompt] If 'Y' input, errorexit set to 1 Else all other input, errorexit 0
The main use is of course within a batch file ... for example -
@ask Do you want to continue? Only 'Y' or 'y' keys will continue ...
this will output -
Do you want to continue? Only 'Y' or 'y' keys will continue ...
and wait for a keyboard input ... anything other than a 'y' key-in will print 'No' and exit with ERRORLEVEL 0, thus you can test for the ERRORLEVEL in the batch file to decide what to do ... This is a sample batch file content
@ask Only Y to continue. Continue?
@if ERRORLEVEL 2 goto NOASK
@if ERRORLEVEL 1 goto CONTINUE
@echo You entered other than the 'Y' key, thus doing nothing ...
@goto END
:CONTINUE
@REM add the actions needed here
dir
@goto END
:NOASK
@echo It seems ask.exe is NOT in the PATH ... check name, location ...
@goto END
:END
Note you can detect whether 'ask.exe' ran by checking for ERRORLEVEL 2 or greater ... 'ask' will only exit with 0 or 1
Some downloads ... as usual, take care downloading and running things from the web. It is highly recommended that you download the source, and compile it yourself. Microsoft offers an 'Express Edition' for free, of their C/C++ IDE tools ...
| Date | File | Size | Notes | Digest |
|---|---|---|---|---|
| September, 2008 | aske02.zip | 28,260 | Runtime | 81bfa26fc37d9ead08c5cf327ace37ab |
| September, 2008 | ask-02.zip | 6,085 | Source | 823adc861a0918b96bbe80f21e361cdd |
Have fun ;=))