1.

Solve : I'm trying to understand the process?

Answer»

What is wrong with the following bat FILE PLEASE.
@echo off
:begin
cls
choice /n /c:123456789 pick a number (1,2,3,4,5,6,7,8,or 9)
rem - the next lines are dependent on keyboard input
if errorlevel 9 goto nine
if errorlevel 8 goto eight
if errorlevel 7 goto seven
if errorlevel 6 goto six
if errorlevel 5 goto five
if errorlevel 4 goto four
if errorlevel 3 goto three
if errorlevel 2 goto two
if errorlevel 1 goto one
goto end
:nine
echo You have PRESSED Nine
goto end
:eight
echo You have pressed Eight
goto end
:seven
echo You have pressed Seven
goto end
:six
echo You have pressed Six
goto end
:five
echo You have pressed Five
goto end
:four
echo You have pressed Four
goto end
:three
echo You have pressed Three
goto end
:two
echo You have pressed Two
goto end
:one
echo You have pressed One
:end

I have spent a number of hours trying to make it work.
You will know that it is a variation on one of your files, and that is why I cannot understand why it will not work.
Hope you can help.
Kind regards.
RonI RAN your code and it WORKS properly. Perhaps you might tell us in what way it doesn't work for you. Also mention your OS and any error messages you are getting.

8-)Thank you for your prompt reply.
The problem was, and I feel rather silly, I saved the prog as "z" and not "z.bat"
It seems to be a common problem with me, either I'm forgeting the space or dot or something so simple. :-?
Thanks again.
RonThe command CHOICE does not exist in Windows prompt window
use the command =

[highlight]@echo off
SET /P choice="PICK A NUMBER (1, 2, or 3)"
IF "%choice%"=="1" GOTO ONE
IF "%choice%"=="2" GOTO TWO
IF "%choice%"=="3" GOTO THREE
[/highlight]

Thank you again.
Ron



Discussion

No Comment Found