本帖最后由 yhcfsr 于 2018-1-16 17:18 编辑
- @echo off &setlocal enableDelayedExpansion
- rem 设置源目录
- set "ScDir=D:\test"
- rem 设置文件清单
- set "FileList=d:\move.txt"
- rem 设置目的目录
- set "DtDir=D:\temp"
-
- set CP1=ABCDEFGHIJKLMNOPQRSTUVWXYZ
- set CP2=BCDEFGHIJKLMNOPQRSTUVWXYZZ
- for /l %%a in (0,1,25) do (
- set /a n=%%a
- call set [%%CP1:~!n!,1%%]=%%CP2:~!n!,1%%
- )
- cd /d "%ScDir%"
- for /f "delims=" %%a in ('type "%FileList%"') do (
- for /f "delims=" %%b in ('dir /a-d /s /b^|findstr "%%a"') do (
- rem 复制文件
- set "FileDir=%%~dpb"
- set "FileDir=!FileDir:~0,-1!"
- robocopy /s "!FileDir!" "%DtDir%\%%a" "%%~nxb"
- rem 重命名文件
- set "name=%%~nb"
- call set "ch=%%[!name:~9,1!]%%"
- set "name=!name:~0,9!!ch!!name:~10!"
- ren "%DtDir%\%%a\%%~nxb" "!name!%%~xb"
- )
- )
- pause&exit
复制代码
|