PC Review


Reply
 
 
someone watching
Guest
Posts: n/a
 
      21st Jun 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


 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      21st Jun 2008

"someone watching" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>


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.


 
Reply With Quote
 
someone watching
Guest
Posts: n/a
 
      21st Jun 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)" <(E-Mail Removed)> wrote in message
news:#b7$BE#(E-Mail Removed)...
>
> "someone watching" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >

>
> 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.
>
>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      21st Jun 2008

"someone watching" <(E-Mail Removed)> wrote in message
news:O48h%23O%(E-Mail Removed)...
> 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


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
.. . .


 
Reply With Quote
 
someone watching
Guest
Posts: n/a
 
      21st Jun 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)" <(E-Mail Removed)> wrote in message
news:OSDpFZ#(E-Mail Removed)...
>
> "someone watching" <(E-Mail Removed)> wrote in message
> news:O48h%23O%(E-Mail Removed)...
> > 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

>
> 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
> . . .
>
>



 
Reply With Quote
 
John Waller
Guest
Posts: n/a
 
      22nd Jun 2008
http://www.ss64.com/nt/goto.html

See also

http://www.ss64.com/nt/index.html

http://commandwindows.com/

--
Regards

John Waller
 
Reply With Quote
 
someone watching
Guest
Posts: n/a
 
      22nd Jun 2008
More great helpful information, thanks!
Vic
___
"John Waller" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> http://www.ss64.com/nt/goto.html
>
> See also
> http://www.ss64.com/nt/index.html
>
> http://commandwindows.com/
>
> --
> Regards
>
> John Waller



 
Reply With Quote
 
someone watching
Guest
Posts: n/a
 
      22nd Jun 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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      22nd Jun 2008

"someone watching" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:11 AM.