1.

Solve : Menu Batch not working?

Answer»

I am trying to get this menu batch to work but every time I run it it just scrolls threw start to command prompt.
I Am running windows xp

Code: [Select]@Echo off
:start
cls
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Main Menu º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º 1.Clear Backup disk º
echo º 2.Backup Files º
echo º 3.Restore Data º
echo º 4. Quit º
echo º º
echo º º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo ===============================
choice /c [:]1.2.3.4. Enter option
echo ===============================
Echo.
If Errorlevel 4 Goto Exit
If Errorlevel 3 goto 3.bat
If Errorlevel 2 goto 2.bat
If Errorlevel 1 goto 1.bat


:1.bat
RD /s /q c:files
cls
RD /s /q a:files
Echo The backup has Been Deleted
Echo.
pause
goto Start

:2.bat
md files
Xcopy e:Files a:files /e/k
pause
Echo Your files have Been Backup
Echo.
tree /f a:
pause
Goto Start

:3.bat
md c\ files
Xcopy a:\files C:\files /e /k
pause
echo The files Have been Restored
echo.
Tree c:files /f
pause
Dir c:\files /s
pause
goto Start

:exit
c:
pause
c:






Any Help would be grateThe first thing I would CHECK is does Choice.exe EXIST on your pc, it is not part of the XP install, so you need to get it.

Change the first line of the batch to @Echo On, so you can see the results of each command, that might give you another clue as to why it isnt working

GrahamI don't have choice on my comp where can i get it if not is there a other way to get the menu to work.Quote from: mdf1 on March 25, 2009, 01:55:08 PM

I don't have choice on my comp where can i get it if not is there a other way to get the menu to work.

You can use SET /P with IF and that will work just as well.

Code: [Select]:loop
set /p choice=
if %choice% == 1 goto 1
if %choice% == 2 goto 2
if %choice% == 3 goto 3
if %choice% == 4 goto 4
Echo You must enter EITHER 1, 2, 3 or 4!
goto loop
Modify that to your uses, but it should fit fine.Code: [Select]@Echo off
:start
cls
echo
echo Main Menu
echo
echo 1.Clear Backup disk
echo 2.Backup Files
echo 3.Restore Data
echo 4. Quit
echo
echo
echo
echo.
echo.
echo ===============================
choice /c [:]1.2.3.4. Enter option
echo ===============================
Echo.
If %Errorlevel%==4 Goto Exit
If %Errorlevel%==3 goto 3.bat
If %Errorlevel%==2 goto 2.bat
If %Errorlevel%==1 goto 1.bat
Batch can't use letters / symbols not on your keyboard.Could you please clarify?


Discussion

No Comment Found