- 'ask' in XP
- Posted by someone watching on June 21st, 2008
In the old DOS days I used a program called 'ASK' in batch files which
allowed me to select a response to a question. According to the answer
(eg, Y/N) the batch file would then branch (goto to the appropriate
label) according to the answer. Does XP have an equivalent? If so, is
there also a help file you can point me to for syntax and errorlevel
information?
Thanks
Vic
- Posted by Pegasus \(MVP\) on June 21st, 2008
"someone watching" <nospam@bogusaddress.com> wrote in message
news:eDaMV690IHA.1240@TK2MSFTNGP02.phx.gbl...
Start a Command Prompt, then type set /? and watch for
the /P option. The user input can be anything, not just Y/N,
but you need to check it yourself.
- Posted by someone watching on June 21st, 2008
Wow, I saw the /P help you mentioned. Wish they had 'instructions for
dummies'. Tried fiddling using the expressions in a file (test.cmd) but
am not making headway. If anyone can help with a simple example it would
sure be appreciated!
eg.
echo.
(command) Would you like to go to label A or label B? AB
if errorlevel 2 goto B
if errorlevel 1 goto A
___
"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:#b7$BE#0IHA.4040@TK2MSFTNGP04.phx.gbl...
- Posted by Pegasus \(MVP\) on June 21st, 2008
"someone watching" <nospam@bogusaddress.com> wrote in message
news:O48h%23O%230IHA.4848@TK2MSFTNGP05.phx.gbl...
Not quite. You need to forget about the clumsy
ErrorLevel stuff used by ask.com. Try this instead:
@echo off
:again
set /P name=Please enter your name:
if "%name%"=="" goto :eof
if /i "%name%"=="Peter" goto Sales
if /i "%name%"=="Jane" goto Accounting
echo Sorry, I don't know a person named "%name%".
goto again
:Sales
.. . .
goto :eof
:Accounting
.. . .
- Posted by someone watching on June 21st, 2008
Looks like that's the kind of 'detail for dummies' I needed <g>!
One last question; noticed the :eof, is this a 'hidden' label which
stands for end of file? or is it like using the exit command?
Thanks Pegasus, your response was very helpful!
Vic
__
"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:OSDpFZ#0IHA.1628@TK2MSFTNGP03.phx.gbl...
- Posted by John Waller on June 22nd, 2008
http://www.ss64.com/nt/goto.html
See also
http://www.ss64.com/nt/index.html
http://commandwindows.com/
--
Regards
John Waller
- Posted by someone watching on June 22nd, 2008
More great helpful information, thanks!
Vic
___
"John Waller" <johnw@REMOVETHISpinnacleweb.com.au> wrote in message
news:usbpkrA1IHA.2384@TK2MSFTNGP04.phx.gbl...
- Posted by someone watching on June 22nd, 2008
At the risk of seeming pesky:
Found I have CHOICE.EXE from W2K (I think, 21KB Dec 21, 1999). Tried
using that in a CMD file. All is well except it does not accept input
from the Esc key. I like to use Esc as the ultimate abort (escape hatch
<g>). Is it possible to have CHOICE accept Esc as a choice?
Lastly, have not tried the set /p command with acceptance of Esc
character. Do you know if set /p will accept Esc key input?
Thanks
Vic
___
"someone watching" <nospam@bogusaddress.com> wrote in message
news:eDaMV690IHA.1240@TK2MSFTNGP02.phx.gbl...
- Posted by Pegasus \(MVP\) on June 22nd, 2008
"someone watching" <nospam@bogusaddress.com> wrote in message
news:etj7zgG1IHA.4040@TK2MSFTNGP04.phx.gbl...
AFAIK, choice.exe was a Win98, not a Win2000 command. About
pressing Esc - why don't you give it a try yourself to see what happens?
Note that in my first response I gave you the standard method for
handling blank input. Not also you that the you MUST press Enter
after typing your response.

