Board logo

标题: WBAT程序切换 [打印本页]

作者: liushegnjie888     时间: 2008-9-11 15:13    标题: WBAT程序切换

比如说我想在AA下的1.exe运行一段时间后运行另外一个程序如BB下的2.exe我该怎么写!
@echo off
cls
@echo off
:top
call w.bat box @dos.bat:menu
if "%?%"=="1" goto AA
if "%?%"=="2" goto BB
if "%?%"=="3" goto CC
if "%?%"=="4" goto DD
if "%?%"=="5" goto EE
if "%?%"=="6" goto FF
if "%?%"=="7" goto exit
goto exit
:menu
======= Select an item to run =======
[1.AA       ]
[2.BB       ]
[3.CC       ]
[4.DD      ]
[5.EE      ]
[6.FF       ]
[7.EXIT    ]
Use dos.bat to show this menu in dos
::

:AA
1.EXE
goto exit

:BB
2.exe
goto exit

:CC
3.exe
goto exit

:DD
4.bat
goto exit

:EE
5.exe
goto exit

:FF
6.exe
goto exit

:exit
作者: lianjiang2004     时间: 2008-9-11 16:13
什么叫运行一段时间后?
作者: xiaoyunwang     时间: 2008-9-11 16:28
@echo off
cls
:: 设置依次菜单调用之间的延时,假设为10秒
set timeout=10

:: 设置用 mpos 环境变量保存程序调用上一个菜单处的位置
set mpos=

@echo off
:top
call w.bat box @dos.bat:menu #%mpos%+1,%timeout%
if "%?%"=="1" goto AA
if "%?%"=="2" goto BB
if "%?%"=="3" goto CC
if "%?%"=="4" goto DD
if "%?%"=="5" goto EE
if "%?%"=="6" goto FF
if "%?%"=="7" goto exit
goto exit
:menu
======= Select an item to run =======
[1.AA       ]
[2.BB       ]
[3.CC       ]
[4.DD      ]
[5.EE      ]
[6.FF       ]
[7.EXIT    ]
Use dos.bat to show this menu in dos
::

:AA
1.EXE
goto top

:BB
2.exe
goto top

:CC
3.exe
goto top

:DD
4.bat
goto top

:EE
5.exe
goto top

:FF
6.exe
goto top

:exit
:: 清空环境变量
set ?=
for %%a in (wbat timeout mpos) do set %%a=
作者: xyh6801     时间: 2008-9-25 15:57
多任务?