Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
here ie is. I want to give the user a choice for which program they would like to run. Please help!
----------------@echo OFF
set LOG = ProgramChoiceLOG.txt
:menu
echo *******************************
echo * choose Your Program(s) *
echo *******************************
echo * *
echo * 1 Access *
echo * 2 Word *
echo * 3 Excel *
echo * 4 All the Above *
echo * *
echo *******************************
rem code helper
echo before input
:input
set INPUT=
set /P INPUT=
if "%input%" =="" goto menu
echo %input%
pauserem code helper
echo before the looppause
goto loop
:loop
(
if "%input%" =="1"
start access.exe >> %LOG%
echo loop1
pauseif "%input%" =="2"
start winword.exe >>"%LOG%"
echo loop2
pause
if "%input%" =="3"
start EXCEL.exe >> "%LOG%"
echo loop3
pauseif "%input%" =="4"
start EXCEL.exe
start access.exe
start winword.exe >> "%LOG%"
echo loop 4rem code helper
echo error handler
pauseif "%input%" =="" goto menu
else goto error
)
:error
echo Not a valid Response! >> "%LOG%"
goto menu
pause

this works in xp pro
@echo OFFset LOG = ProgramChoiceLOG.txt
:menu
echo *******************************
echo * choose Your Program(s) *
echo *******************************
echo * *
echo * 1 Access *
echo * 2 Word *
echo * 3 Excel *
echo * 4 All the Above *
echo * *
echo *******************************
echo before inputset INPUT=
set /P INPUT=
if "%input%" =="" goto menu
pauseecho before the loop
pause
echo here
path = "C:\Program Files\Microsoft Office\Office"
if("%input%" =="1") then
ECHO TEST
start msaccess.exe
echo loop1
pause
end if

here you go Paul this works on 98se not tested on xp pro but I have used choice in xp pro before with no problems
@echo OFF
:menu
echo *******************************
echo * choose Your Program(s) *
echo *******************************
echo * *
echo * 1.. Access *
echo * 2.. Word *
echo * 3.. Excel *1
echo * 4.. All the Above *
ECHO.
ECHO.
ECHO VALID ENTRIES ARE 1, 2, 3 OR 4 ONLY
echo * *
echo *******************************
ECHO.
ECHO.choice /c:1234/N "Enter choice "
IF ERRORLEVEL == 4 GOTO ALL
IF ERRORLEVEL == 3 GOTO EXCEL
IF ERRORLEVEL == 2 GOTO WORD
IF ERRORLEVEL == 1 GOTO ACCESS
:ACCESS
start msaccess.exe
goto end:WORD
start winword.exe
goto end:EXCEL
start excel.exe
goto end:ALL
start EXCEL.exe
start MSaccess.exe
start winword.exe
goto end:end
cls

Here is my finished product. I was just having a lot of QUOTES problems thats all, but I liked you layout a lot more thn mine it;s mre readable
============================================@echo OFF
set LOG = ProgramChoiceLOG.txt
:MENU
cls
echo *******************************
echo * choose Your Program(s) *
echo *******************************
echo * *
echo * 1 Access *
echo * 2 Word *
echo * 3 Excel *
echo * 4 All the Above *
echo * *
echo * Q to Quit *
echo * *
echo *******************************
echo.set INPUT=
set /P INPUT=rem The path below should be the same on all personal computers
rem path = "C:\Program Files\Microsoft Office\Office"if "%input%" =="" goto MENU
if %input% == 1 goto ACCESS
if %input% == 2 goto WORD
if %input% == 3 goto EXCEL
if %input% == 4 goto ALL
if %input% == Q goto QUIT
if %input% GEQ 5 goto ERROR:ACCESS
start msaccess.exe
goto MENU:WORD
start winword.exe
goto MENU:EXCEL
start excel.exe
goto MENU:ALL
start msaccess.exe
start winword.exe
start excel.exe
goto MENU:QUIT
echo.
echo Thank you Goodbye
echo.
echo.
pause
exit:ERROR
echo.
echo You MUST enter one of the choices listed on the menu!
echo.
pause
goto MENU

Recently, I typed a list of commands and now my instructer wants me to create a batch file using notepad;the commands are COPY, CD, REN, MD, REM, DEL, DIR. Maybe you can help me understand what she wants by giving me an example then I'll do the rest. Thank you

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |