在D:\下有一個文件夾:D:\face,在這個文件夾下存放著一個照片文件夾:D:\face\1,一個存入學生UserID文本文件:D:\face\UserID.txt。
把D:\face\1??文件夾下的照片名批量以學生ID重新命名。

1,創(chuàng)建一個UserID.txt(存放UserID)
2,創(chuàng)建一個new.bat文件,代碼如下
@echo on&setlocal enabledelayedexpansion
for /f "delims=U" %%a in ('cmd /u /c echo 唉') do set "tab=%%a"
cd /d "D:\face\1"
(for /f "delims=" %%a in ('echo ##^&echo ##^&dir /b/od *.png') do (
? ? set/p fn=
? ? if not "%%a"=="##" (?
? ? ? for /f "tokens=1 delims=%tab%" %%b in ("!fn!") do echo ren "%%a" "%%b.png">>"D:\face\b.bat"
? ? )? ? ? ? ?
))<"D:\face\UserID.txt"
pause
3,創(chuàng)建一個空的b.bat
4,執(zhí)行new.bat后b.bat文件應該如下
ren "weixin313.png.png" "1053.png"
ren "weixin932.png.png" "1054.png"
ren "weixin924.png.png" "1055.png"
..............................
5,將b.bat放入D:\face\1執(zhí)行。