回复 18# dreamhony
17楼代码效率低一些,有for嵌套,在for循环中还有命令findstr。下面代码消除了for嵌套和findstr,循环次数大大降低,效率上应当提高不少:- @echo off
- cd /d E:\文件夹1
- setlocal enabledelayedexpansion
- for /f %%a in (1.txt) do set _%%a=true
- for /f "tokens=1* delims=_" %%i in ('dir /b /ad') do (
- if defined _%%j (
- md "E:\文件夹2\%%i_%%j"
- copy "%%i_%%j\*.*" "E:\文件夹2\%%i_%%j"
- )
- )
- pause
复制代码
|