请教个批处理执行程序

来源:百度知道 编辑:UC知道 时间:2024/06/18 06:06:53
就是运行一个批处理能自动检测有没有z:盘下的XX文件夹下的xx.exe,如果检测到则运行这个程序,运行后退出批处理,如果检测不到,继续检测,z:盘盘符不固定的,谢谢了
我试了不行的,运行一次就没了,不行就写成个小程序,能不能给我写个就是就是运行这个程序能自动检测有没有z:盘下的wz文件夹下的VStart.exe,如果检测到则运行这个程序,运行后退出本程序,如果检测不到,继续检测,z:盘盘符不固定的,能加个配置文件更好,文件路径= \wz\VStart.exe,不指定盘符,盘符自动搜索的
我试了这个批处理不行,请教高手写成个软件最好

@echo off&&setlocal enabledelayedexpansion
:loop
for /f "tokens=1,2,* delims= " %%a in ('mountvol ^| find /i ":\" ^| find /v /i "a:\"') do (
set disk=%%a
if exist !disk!xx\xxx.exe call :doit
)
goto loop
:doit
start !disk!xx\xxx.exe
exit
rem *************************************
rem 星号以上代码另存为xx.bat
rem 屏蔽了A盘盘符(软驱),如果你不需要可以消息我

问题一次性描述清楚!!!!!!!
@echo off
:slz
for %%i in (C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) do (
for /f "delims=" %%a in ('dir /s/a-d/b "%%i:\wz\VStart.exe"' 2^>nul') do set "VStart=%%a"
)
if defined VStart (start "" "%VStart%"&exit)
ping -n 3 127.1>nul
goto slz

for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do (if exist %i:\wz for /r %i: %%j in (Vstart.exe) do start VStart.exe & exit))