:: 文件列表,然后在visitcmd.bat的代码中引用%VisitFile%第三至最后的串,
:: 再使用文件列表进行遍历
::
:: 测试报告:
:: 在 Win98 命令行方式下有限黑箱测试通过
:: 性能仍然是最大的瓶颈
::
@echo off
if "%1"=="$" goto MakeList
if "%1"=="@" goto CopyList
if "%1"=="" goto End
set VisitCommand=%0
:GetArgu
:GetPath
if not exist %1.nul goto GetSwitch
set VisitPath=%VisitPath% %1
goto GetNext
:GetSwitch
echo %1 | find "/" > nul
if errorlevel 1 goto GetFilter
set VisitSwitch=%VisitSwitch% %1
goto GetNext
:GetFilter
echo %1 | find "*" > nul
if not errorlevel 1 goto SetFilter
echo %1 | find "?" > nul
if errorlevel 1 goto End
:SetFilter
set VisitFilter=%VisitFilter% %1
:GetNext
shift
if not [%1]==[] goto GetArgu
%VisitCommand% $ %VisitFilter%
:MakeList
if not [%VisitPath%]==[] goto ForMake
:DirMake
dir %2 /b %VisitSwitch% >> ~
goto MakeNext
:ForMake
for %%p in (%VisitPath%) do dir %%p.%2 /b %VisitSwitch% >> ~
:MakeNext
shift
if not [%2]==[] goto MakeList
find "~" /v < ~ > ~
if not errorlevel 1 copy ~ ~>nul
goto MakePreLine
:CopyList
if not [%2]==[] if exist %2 type %2>>~
shift
if not [%2]==[] goto CopyList
:MakePreLine
if not exist ~ goto End
echo set VisitFile=> ~
for %%c in (rcx e w q) do echo %%c>> ~
debug ~ < ~ > nul
if [%OS%]==[Windows_NT] chcp 936 > nul
:LoopVisit
copy ~+~ ~ > nul
find "set VisitFile=" < ~ > ~visit.bat
call ~visit.bat
if "%VisitFile%"=="" goto Clear
if not exist visitcmd.bat echo Visiting %VisitPath% %VisitSwitch% %VisitFilter% - %VisitFile%
if exist visitcmd.bat call visitcmd.bat
find "set VisitFile=" /v < ~ > ~
goto LoopVisit
:Clear
for %%f in (~visit.*) do del %%f
for %%e in (Command Path Switch Filter File) do set Visit%%e=
:End
在2000sp4 下出现类似的问题,第二个问题实际上也是fc的不兼容问题,他在按行号显示时,每行文字前有8 个字节位,而不是dos6和win9x 下的9 个,所以解决起来也很简单,将debug 脚本中的 e 100 'set file='改为 e 100 'set fil=' 即可。
但是,这只是就事论事而已,以上的提到的三个批处理,只是我在dos 下练兵用的试验原型,做得很粗糙,自从今年3 月份正式转向win98 之后,使用中遇到了很多新问题,比如文件名包含空格的问题,系统/ 隐藏属性目录的问题;在nt下使用,又遇到了中文文件名的问题;而且由于循环体中使用了过多的文本流控制,导致了效率的严重低下;另外,三个程序功能上和实现上并没有太大的差别,没有拆分的必要。
综所上述,将以上代码重写就成为必须。合并代码,弥补漏洞,改善性能,书写文档,就出现了所谓的 V2 版,这中间其实并没有花很多功夫。









