ask utility

external links: index . projects . home

in-file links: preamble - help - downloads - end

Preamble

2016/03/29: As of a few years ago published the source on GitLab - https://gitlab.com/fgtools/gtools/tree/master/ask - making it easy to get.

2013/07/30: Update to also compile and run in linux. See ask-03.zip source below

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 ;=((

top


Help

My 'ask' application does have a brief HELP, seen by using a /? or -? command ...

Prompt> ask -?
  Brief Help on Usage - Jul 30 2013 15:08:19
  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

top


Downloads

The latest source is now available in GitLab - https://gitlab.com/fgtools/gtools/tree/master/ask

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 ... This is now a CMake project, and can also be compiled in linux.

Downloadable source and binaries for WIN32
Date File Size Notes Digest
July, 2013 ask-03.zip 15,158 src & rt f98cf8f4dea3729d1bf2dc258368104c
September, 2008 aske02.zip 28,260 Runtime 81bfa26fc37d9ead08c5cf327ace37ab
September, 2008 ask-02.zip 6,085 Source 823adc861a0918b96bbe80f21e361cdd

 

Have fun ;=))

top


checked by Tidy  Valid XHTML 1.0 Transitional