Windows 按列表重命名文件

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

rem Load the list of new filenames
set i=0
for /F "delims=" %%a in (names.txt) do (
   set /A i+=1
   set "newname[!i!]=%%a"
)
rem Do the rename:
set i=0
for /F "delims=" %%a in ('dir /b /o:n *.*') do (
   set /A i+=1
   for %%i in (!i!) do ren "%%a" "!newname[%%i]!"
)

参考

最后更新于