- @echo off
- for /f "delims=" %%i in ('dir /a:-d /b') do (
- echo "%%i" | findstr "ex" && (
- copy "%%i" \\192.168.20.2\Report\dj
- set /a n += 1
- )
- echo "%%i" | findstr "花肥 亚欧 敖德萨" && (
- copy "%%i" \\192.168.20.2\Report\jj
- set /a n += 1
- )
- )
- echo 复制了 %n% 个文件
- echo 按任意键退出
- pause
复制代码 建议用以下代码,虽然代码比你原来的多,但是速度快一点。
(以下代码不能统计复制数量。。)- @echo off
- for /f "delims=" %%i in ('dir /a:-d /b') do (
- set var=%%i
- SetLocal EnableDelayedExpansion
- if "!var:ex=!" neq "!var!" (
- copy "!var!" \\192.168.20.2\Report\dj
- set /a n += 1
- )
- for %%a in (花肥 亚欧 敖德萨) do (
- if "!var:%%a=!" neq "!var!" (
- copy "!var!" \\192.168.20.2\Report\jj
- set /a n += 1
- )
- )
- EndLocal
- )
- echo 复制了 %n% 个文件
- echo 按任意键退出
- pause >nul
复制代码
[ 本帖最后由 tmplinshi 于 2010-12-26 17:40 编辑 ] |