HTH
--
Gruesse Greetings Saludos Saluti Salutations
Matthias
---------+---------+---------+---------+---------+---------+---------+
> Anyboy have any idea why choice won't work anymore?
Choice isn't a standard part of XP. You can still use the choice.exe from
Win9x etc.
As explained in
103196 Sep 8 2004 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi
14) Help! My old batch files won't work since there is no choice.
Q: When I try to run my old batch file as a CMD.EXE script I get
"'choice' is not recognized as an internal or external command,
operable program or batch file." What can I do?
A: The CHOICE command has been dropped because it can cause
collisions in the NT/2000/XP multi-tasking environment. Thus the
best choice (if you pardon the pun) is not try to find an old
version, but patiently write your scripts anew using SET /P. Below
is a simple demonstration
@echo off
setlocal
:_again
set /p ask_="Please respond [Y,N,Q]?"
for %%a in (y n q) do if /i "%ask_%"=="%%a" goto _%%a
goto _again
::
:_y
echo Your input was Yes& goto :EOF
:_n
echo Your input was No& goto :EOF
:_q
echo Your input was Quit& goto :EOF
endlocal
However, you might try a clone such as CHOOSE.EXE "Ask questions in
batch/script files" from ftp://garbo.uwasa.fi/pc/ts/tsutlf17.zip or
later. (Now also included in tscmd.zip)
@echo off & setlocal enableextensions
choose /tq,5 /cynq "Give your answer "
if errorlevel==0 if not errorlevel==1 echo You effected a break
if errorlevel==1 if not errorlevel==2 echo Your input was Yes
if errorlevel==2 if not errorlevel==3 echo Your input was No
if errorlevel==3 if not errorlevel==4 echo Your input was Quit
if errorlevel==255 echo Error condition
endlocal & goto :EOF
Alternatively
@echo off & setlocal enableextensions
choose /tq,5 /cynq /x "Give your answer "
for %%c in (call del) do %%c choose_.bat
if "%choose_%"=="0" echo You effected a break
if "%choose_%"=="1" echo Your input was Yes
if "%choose_%"=="2" echo Your input was No
if "%choose_%"=="3" echo Your input was Quit
if "%choose_%"=="255" echo Error condition
endlocal & goto :EOF
The output in both the cases might be e.g.
D:\TEST>cmdfaq
Give your answer [Y,N,Q]?Q
Your input was Quit
The obvious advantage of CHOOSE.EXE over the SET /P method is that
the former can handle timed default input.
All the best, Timo
--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html
> However, you might try a clone such as CHOOSE.EXE "Ask questions in
> batch/script files" from ftp://garbo.uwasa.fi/pc/ts/tsutlf17.zip or
> later. (Now also included in tscmd.zip)
snip...
> The obvious advantage of CHOOSE.EXE over the SET /P method is that
> the former can handle timed default input.
What sort of collisions are you referring to? Filename?
--
Todd Vargo (double "L" to reply by email)
> > What sort of collisions are you referring to? Filename?
> I picked the claim up some time ago, and can't find to source. Maybe
It probably was this:
http://www.google.com/groups?selm=3E1C6329...@uclink.berkeley.edu
All the best, Timo
--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip
I just remember that now! I had an old copy of choice somewhere on my
Windows 2000 resource kit directory on my old computer that I had
forgotten about. I have a new computer now and of course choice is not
there. I will use the set /p command instead.
Thanks all for the replies
Thanks I'll give Choose.exe a try
> Anyboy have any idea why choice won't work anymore?
Hi EdP,
Choice is not a standard part of the Windows XP installation, so you'll
need another alternative. Prof. Salmi has a choose.exe, but
unfortunately it's an MS-DOS executable that executes rather slowly on
the NT/2000/XP platform.
I wrote a Win32 console program called getkey.exe that runs much more
quickly and provides the same feature set.
http://home.comcast.net/~stewartb/getkv.html
Regards,
Bill
Your getkey and getvar exe's are awesome Bill. I just wanted
to give you some praise (: Thankyou for releasing them with
no strings attached, you're a legend in my book (:
--
Till
> Your getkey and getvar exe's are awesome Bill. I just wanted to give
> you some praise (: Thankyou for releasing them with no strings
> attached, you're a legend in my book (:
Hi Till,
Thanks! Glad they are useful.
Bill