Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: accept user input from a batch file without using choice/wscript etc

48 views
Skip to first unread message

Herbert Kleebauer

unread,
Feb 13, 2007, 3:54:18 AM2/13/07
to
dalu...@gmail.com wrote:
>
> Hi,
> I want to accept user input from a bat file, this can be achieved by
> using choice.com, but this command is not available in all dos
> version. can u please help me out to the same can be achieved by
> writing code that can run in any dos(>ver 4.0)

You can include a choice like program in your batch code:

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>getkey.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>getkey.com
echo L?p{KsUWK`LR0x>>getkey.com

getkey.com
if errorlevel 89 if not errorlevel 90 echo Y key pressed
if errorlevel 121 if not errorlevel 122 echo y key pressed
if errorlevel 78 if not errorlevel 79 echo N key pressed
if errorlevel 110 if not errorlevel 111 echo n key pressed
del getkey.com
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Or if you want to input strings:

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
echo myinput.bat hoAX5@@PZYh@xX5@D3!r/P[WX,b,-PZh>>myinput.com
echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com

echo Enter your name:
myinput.com
call myinput.bat
echo.
echo Hello %input%

del myinput.com
del myinput.bat
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

But if you are speaking of Windows, then there always should be
choice.com or set /p (maybe with the exception of NT).

0 new messages