我写的一个类似的批处理,你稍加修改一下应该可以解决问题:xyfpath.bat:用来设置搜索路径:
@echo off
set drives=
for %%D in (C: D: E: F: G: H: I: J: K: L: M: N: P: Q: R: S: T: U: V: W: X: Y: Z<img src="images/smilies/face-laugh.png" align="absmiddle" border="0"> DO Call IsReady %%D
::echo %drives%
::pauseset mypath=
for %%D in (%drives%) DO if exist %%D\syssoft\clone\systools\ghost.exe apath *mypath %%D\SYSSOFT\CLONE\SYSTOOLS;%%D\SYSSOFT\CLONE\DOSTOOLS;%%D\SYSSOFT\CLONE\WINTOOLS
if exist c:\ucdos\nul apath c:\ucdos
if exist c:\dos71\nul apath c:\dos71
if exist c:\dos\nul apath c:\dos
if exist c:\batch\nul apath c:\batch
for %%D in (%drives%) DO if exist %%D\systools\pqmagic.exe apath *mypath %%D\SYSTOOLS;%%D\DOSTOOLS;%%D\WINTOOLSif not "%mypath%"=="" apath %mypath%
if "%mypath%"=="" goto _nopath
set drives=
set mypath=
goto _quit:_nopath
echo Sorry! I cannot find any xyf's path on your system.
echo PATH NOT SET!!!
pause:_quit
IsReady.bat:用来判断某个盘符是否准备好:
@echo off
dready %1 > nul
if errorlevel 1 goto _quit
if errorlevel 0 set drives=%1 %drives%
:_quit