Re lin8197:
It seems that the first problem encountered is the judgment of non-hard disk drive letters. Because when 98 and DOS use if exist to access an unprepared drive, an error message will appear, while XP and 2000 ignore this error.
To solve it, first ensure that the drive letter list is as small as possible. I don't know how your c~m is determined. If possible, try to narrow its range as much as possible. In addition, a check should be made for whether each drive letter is ready. The simplest way is to use the third-party tool dready.com, which comes from the hosrt32 tool kit. The usage is as follows (the program has not been tested either). If your environment is not suitable for using the third-party tool, you can dynamically generate a script and then use debug to call the DOS interrupt to get a similar effect.
In addition, if used below DOS 6.xx, please pay attention to the 8.3 filename convention, otherwise some unexpected errors will occur.
@echo off
if == %0 $ c d e f g h i j k l m
:loop
shift
if == goto end
dready %1
if errorlevel 2 goto loop
for %%f in (a.exe b.exe c.bat) do if exist %1:\aaaa\%%f copy %1:\aaaa\%%f c:\
goto loop
:end
※ Batchinger 致 Bat Fans:请访问
批处理编程的异类 ,欢迎交流与共享批处理编程心得!