标签:
因为要重命名的字符串中有文字,导致重命名出来的文件名都变为乱码了,查理一下需要加两句话
1.
@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.html
2. 循环加数字自增长
@Echo Off SetLocal EnableDelayedExpansion For /R %%i In (*.txt) Do ( Set /A Ti+=1 Set Ti=0!Ti! Ren "%%~nxi" "!Ti:~-2!%%~nxi" )
3. 文字替换
@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.html
for命令详解
http://mmmzzc.iteye.com/blog/1090309
Dos/Bat
http://www.jbxue.com/jb/dos/
标签:
原文地址:http://www.cnblogs.com/neru/p/4685607.html