本帖最后由 qixiaobin0715 于 2021-1-7 22:42 编辑
回复 23# k员外
再试试,不行的话,我放弃
人名文件夹放在这D:\abc
带编码的文件夹放在这D:\123- @echo off
- set folder1=D:\abc
- set folder2=D:\123
- setlocal enabledelayedexpansion
- for /d %%a in ("%folder2%\*") do (
- set "str=%%~na"
- set "str1=!str:~0,19!"
- set "str2=!str:~19!"
- for /f "delims=" %%b in ('dir /b /ad "%folder1%\*!str2!*"') do ren "%folder1%\%%b" "!str1!%%b"
- )
- pause
复制代码
|