Articles

automatic enter dos bat file

dell
July 21, 2008 at 09:52:03
Specs: win xp s/p 3, 3mhz/2 gig

Hi, I need to know how to enter a key in dos without pressing enter.
Ie:
at the command prompt the user must press 1 - 5 and as soon as the user presses the number that number automatically goes to the next step.

Thank you


See More: automatic enter dos bat file

Report •


#1
July 21, 2008 at 12:52:29

::== my.bat

choice /c12345
goto :%errorlevel%

:1

:2

and so on


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
July 22, 2008 at 06:43:04

Hi Mechanix2Go, I tried your solution and couldnt get it to work. I will attempt it again tonight when I get home.
Thank you for your assistance with this.

Report •

#3
July 22, 2008 at 14:24:07

Hi there Mech. I was looking at some other posts you have helped with... quite a collection going there!
Ok, I have a simple "Loop Menu" system here.
=============================================
@ECHO OFF
:MAINMENU
CLS
@ECHO Please Make Selection...
@ECHO.
@ECHO 1. DISPLAY THE NUMBER "1"
@ECHO 2. DISPLAY THE NUMBER "2" AND EXIT
SET CHOICE=
@ECHO.
SET /p CHOICE=Type the number to make selection. -
IF '%CHOICE%'=='1' GOTO CHOOSE1
IF '%CHOICE%'=='2' GOTO EXIT
COLOR 04
CLS
@ECHO.
@ECHO.
ECHO "%CHOICE%" IS NOT VALID, PLEASE TRY AGAIN. PRESS ANY KEY TO RESET...
PAUSE>NUL
COLOR 07
GOTO MAINMENU
:CHOOSE1
CLS
@ECHO USER PRESSED "1".
PAUSE
GOTO END
:EXIT
CLS
@ECHO USER PRESSED "2".
PAUSE
EXIT
:END
GOTO MAINMENU
=============================================

NOW I KNOW YOU CAN, but please will you incorporate your answer into my menu as I did try, and I failed!
Thanks
Lee


Report •

Related Solutions

#4
July 23, 2008 at 01:14:00

@ECHO OFF

:menu

ECHO Please Make Selection...

CHOICE /c12

goto :%errorlevel%

:1
ECHO USER PRESSED "1".
PAUSE
GOTO :menu

:2
ECHO USER PRESSED "2".
PAUSE


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#5
July 23, 2008 at 01:28:09

Hi Mech, please see the error I get.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>menu1
Please Make Selection...
'CHOICE' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the batch label specified - 9009

So it seems that Win XP isnt DOS friendly!
Do you have any suggestions?


Report •

#6
July 23, 2008 at 02:33:47

I Thought CHOICE was included in XP.

Your can get it here:

http://golden-triangle.com/CHOICE.COM


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#7
July 23, 2008 at 03:27:37

Thanks again! I will try that out tonight.
Cheers

Report •

#8
July 25, 2008 at 04:00:58

Hi there, thank you for that. I downloaded Choice.exe and Sleep.exe and bat2exe. Now I can do what I originally wanted, however these days, most people dont want to download exe files as they cant use them on their 'work' computers.
So I am going to settle for the user just pressing the selection and then pressing enter.
Thank you for your help though.
Keep up the good work.

Report •


Ask Question