1.

Solve : Menu with run all ??

Answer»

Here is my Menu code:

Code: [Select]@echo off
D:
CD \Example\Samples
goto menu
:menu
echo.
echo What would you like to do?
echo.
echo Choice
echo.
echo 1 Run AntiAlias
echo 2 Run HDRLighting
echo 3 Run ShadowMap
echo 4 Quit
echo.

:choice
set /P C=[1,2,3,4]?
if "%C%"=="4" goto quit
if "%C%"=="3" goto ShadowMap
if "%C%"=="2" goto HDRLighting
if "%C%"=="1" goto AntiAlias
goto choice

:AntiAlias
start AntiAlias.exe
goto menu

:HDRLighting
start HDRLighting.exe
goto menu

:ShadowMap
start ShadowMap.exe
goto menu

:quit
exit
:end

How do i make a menu 1,2,3,4,5 .
5 will be Quit, 4 will run 1 for 20 minutes and STOP running (exit), then run 2 for 20 minutes and stop running, then 3 and running for 20 minuts and quit.

Thanks for sharing
Please post your os:
Is it maybe pure DOS?
And some Windowsversions are not shipped with the choice commmand.

uliOh sorry, I am USING Windows XP Professional , and use DOS cmd promp
Thanks for replying .Windows XP & DOS

Option 4 could get complicated. Before each program in option 4 runs it would need to start another batch file which would sleep for 20 minutes, and then continue by querying the task list and killing run 1; this would be repeated for run 2 and run 3.

What are you TRYING to accomplish? What happens if run 1, 2, 3 don't run 20 minutes?

8-)Oh I just try to see we can use this trick for DOS or not . And how we kill process when it is running , so i can learn. 1,2,3 we have to stop manual no way it can stop by itself , but nothing is impossible , only I never learn it beforeQuote

5 will be Quit, 4 will run 1 for 20 minutes and stop running (exit), then run 2 for 20 minutes and stop running, then 3 and running for 20 minuts and quit.

Option 4 will run sequentially as you REQUESTED.

Menu Code:
Code: [Select]@echo off
D:
CD \Example\Samples
goto menu
:menu
echo.
echo What would you like to do?
echo.
echo Choice
echo.
echo 1 Run AntiAlias
echo 2 Run HDRLighting
echo 3 Run ShadowMap
echo 4 Run All
echo 5 Quit
echo.

:choice
set /P C=[1,2,3,4]?
if "%C%"=="5" goto quit
if "%C%"=="4" goto All
if "%C%"=="3" goto ShadowMap
if "%C%"=="2" goto HDRLighting
if "%C%"=="1" goto AntiAlias
goto choice

:AntiAlias
start AntiAlias.exe
goto menu

:HDRLighting
start HDRLighting.exe
goto menu

:ShadowMap
start ShadowMap.exe
goto menu

:All
start Wait.bat AntiAlias.exe
AntiAlias.exe
start Wait.bat HDRLighting.exe
HDRLighting.exe
start Wait.bat ShadowMap.exe
ShadowMap.exe
goto menu

:quit
exit
:end

You will also need this second batch file (wait.bat):

Wait Code:
Code: [Select]sleep 1200
for /f %%x in ('tasklist /fi "imagename eq %1"') do (
taskkill /f /im %1
)

Using the start command creates separate threads and an additional layer of complexity.

Good luck. 8-)How do you do wait batch with all the kill threat ?I should have mentioned that the sleep command can be found in the Win 2003 Resource Kit. According to my pre-No Child Left Behind math 1200 seconds is 20 minutes.

One problem is neither window has a clue what the other is doing. If one of the executables ends early, the wait window will continue to wait and launch a kill for a task that doesn't exist, another wait window will get started along with a new executable. Slowly the entire run unit will unravel.

Why can you not let each job run to completion?

8-)



Discussion

No Comment Found