本帖最后由 qixiaobin0715 于 2021-11-29 09:10 编辑
未测试。这种情况最好不要将文件拷贝到与源文件夹相同目录,以免相互干扰(我把拷贝文件夹放到了桌面):- @echo off
- cd /d "D:\"
- set "DesFolder=%USERPROFILE%\desktop\已筛选"
- md "%DesFolder%"
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /b /s /ad') do (
- set /a n+=1
- set #!n!=%%a
- )
- (for /f "delims=" %%i in (a.txt) do (
- set m=
- for /l %%j in (1,1,%n%) do (
- if exist "!#%%j!\*-%%i-*.*" (
- move "!#%%j!\*-%%i-*.*" "%DesFolder%">nul
- set m=true
- )
- )
- if not defined m echo,%%i
- ))>"未查询到.txt"
- pause
复制代码
|