Re lin8197: 看样子首先遇到了非硬盘盘符判断问题。因为98和dos用if exist 访问未准备好的盘时会出现错误提示,而xp,2000是忽略这个错误。 解决它,首先保证盘符列表尽可能的小,我不知道你的c~m是如何确定的,如果可能的话,尽量缩小其范围。另外,对于每个盘符都应该做一个是否准备好的检测,这个最简单的办法是使用第三方工具dready.com,来自hosrt32工具包,用法如下(程序同样未经测试)。如果你的环境不适宜使用第三方工具,可以动态生成一个脚本,然后使用debug来调用dos中断来得到类似的效果。 另外,如果在dos6.xx以下使用,请注意使用8.3文件名约定,否则会出现一些意外的错误。
@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
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