- @echo off & setlocal enabledelayedexpansion
-
- set templateDir=%~dp0A
- set targetDir=%~dp0B
- set tmp$=%~dp0$
-
- dir /b "%templateDir%" >"%tmp$%"
-
- pushd "%targetDir%"
- (for /f "delims=" %%i in ('dir /b /od') do (
- set /p nName=
- ren "%%i" "!nName!"
- ))<"%tmp$%"
- popd
- del /q "%tmp$%"
-
- pause & exit /b
复制代码
|