Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

choice.com and winnt

Status
Not open for further replies.

teelo

Technical User
Sep 3, 2002
6
NZ
Has windows NT removed the command CHOICE.COM ???
If so, is there a similiar command that can be used in Win2000/NT????????
 
I didn't know that NT had Choice. If you have DOS 5, 6 or Win 95/98/ME then you should be able to find it.

I'm not certain on XP though.
--MiggyD

NOTE:
In Win 95/98/ME it's in the (windows)\COMMAND folder.
In DOS it's obviously in the DOS folder (or use EXTRACT to get it out of the OEM disketts.)
 
Create your own Choice.com. Since this is a BASIC forum, I guess this is appropriate....

Use Quick Basic 4.5 or higher:[tt]

' Start QB with the /l qb.qlb parameters....
' Create a program with this code and compile it
' as MYCHOICE.EXE
DECLARE SUB Bye CDECL ALIAS "_exit" (BYVAL RetVal%)
C$ = COMMAND$
IF C$ = "" THEN
PRINT "Tap a key. A value will be returned in ERRORLEVEL. ";
ELSE
PRINT C$;
END IF
DO
I$ = INKEY$
IF I$ <> &quot;&quot; THEN
' Subtract 64 from the ASCII value
' of the key press.
' &quot;A&quot; will return 1, &quot;B&quot; returns 2, etc.
RetVal% = ASC(I$) - 64
EXIT DO
END IF
LOOP
Bye RetVal%
[/tt]
Then create a batch file to use MYCHOICE.EXE....[tt]
@ECHO OFF
echo CAPSLOCK should be ON
MYCHOICE Select A, B or C (A,B,C)?
IF ERRORLEVEL 3 GOTO Cpressed
IF ERRORLEVEL 2 GOTO Bpressed
IF ERRORLEVEL 1 GOTO Apressed
GOTO Done
:Cpressed
ECHO C WAS PRESSED
GOTO DONE
:Bpressed
ECHO B WAS PRESSED
GOTO DONE
:Apressed
ECHO A WAS PRESSED
:Done

VCA.gif
 
What I meant was, did Windows NT stop using choice.com
I was always able to use it in Dos and win9x but not in Win NT.
 
That sounds like a purely academic question. Are you interested in trapping and passing keystrokes or do you just want to know why Microsoft didn't include the 16-bit utilities when it shipped NT?
VCA.gif

Do no harm.​
 
I'm sitting in front of a Windows NT4 SP6a machine and CHOICE works here.

Here's text captured from the DOS window...
Code:
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.

C:\>choice /?
CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]

/C[:]choices Specifies allowable keys. Default is YN
/N           Do not display choices and ? at end of prompt string.
/S           Treat choice keys as case sensitive.
/T[:]c,nn    Default choice to c after nn seconds
text         Prompt string to display

ERRORLEVEL is set to offset of key user presses in choices.



C:\>ver

Windows NT Version 4.0

C:\>ver

- Chuck Somerville
 
Hi,

No, &quot;choice&quot; is not part of Windows any more.
SET /P is way to go.

Type command line command:
SET /?
and scroll down till section
SET /P variable=[promptString]

It is up to you how to develop the solution.

Happy reading and good luck.
vjc000.
 
typical choice code below:

SET Q=Y
:QUERY
set /p Q=Do you want to install?: Y
if /i %Q% equ n goto end
if /i %Q% equ y (command XXX) ELSE GOTO LOERROR
GOTO end
:LOERROR
ECHO INVALID RESPONSE
SET Q=Y
goto :QUERY
:end
 
OK, thanks, sorry I didnt understand before, I was actually meaning win2k...
I had just been trying to use choice for a batch file and was confused then as to why I couldnt, but now I know...

I will try that set /? then...

Code:
on error goto [URL unfurl="true"]www.tek-tips.com[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top