由於要重命名的字符串中有文字,致使重命名出來的文件名都變爲亂碼了,查理一下須要加兩句話html
1.post
@Echo Off Chcp 65001>nul SetLocal EnableDelayedExpansion for /f %%i in ('dir /b *.PDF') do (ren %%i 文字_%%i) Chcp 936>nul
http://zhidao.baidu.com/question/303817950046214524.htmlurl
2. 循環加數字自增加spa
@Echo Off SetLocal EnableDelayedExpansion For /R %%i In (*.txt) Do ( Set /A Ti+=1 Set Ti=0!Ti! Ren "%%~nxi" "!Ti:~-2!%%~nxi" )
3. 文字替換code
@Echo Off SetLocal EnableDelayedExpansion For %%i In (*.txt) Do ( For /F "Usebackq Delims=" %%j In ("%%~nxi") Do ( Set Str=%%j Echo !Str:BG-hd=%%~ni!>>New_%%~nxi ) )
http://www.cnblogs.com/meil/archive/2013/03/12/2955019.htmlhtm
for命令詳解blog
http://mmmzzc.iteye.com/blog/1090309 字符串
Dos/Batget
http://www.jbxue.com/jb/dos/it