本帖最后由 aloha20200628 于 2024-11-9 09:59 编辑
回复 1# luckboy45
代码第三行设置要搜索多少个盘符根目录
假设 list.txt 总字符量不超过 8100 个字符 》为尽量提升 dir/b/s 一次性全盘搜索效率须尽量用满其命令行参数空间
- @echo off &setlocal enabledelayedexpansion &set "s=" &cd.>list1.txt
- for /f "delims=" %%a in (list.txt) do (set s=!s! "%%~nxa")
- for %%d in ("c:\", "d:\", "e:\") do (
- cd /d %%d &dir /b/s/a-d !s!>>"list1.txt"
- set "s=" &(for /f "delims=" %%a in (list1.txt) do echo,%%~nxa)>"0.0"
- for /f "delims=" %%a in ('findstr /ivg:"0.0" list.txt') do (set s=!s! "%%a")
- if not defined s goto[end]
- )
- :[end]
- del/q "0.0"&endlocal&pause&exit/b
复制代码
|