[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
回复 13# wocool
欢迎修改代码,只要能解决问题就好。

TOP

回复 3# Batcher


    开回显的输出,E盘测试
C:\ _
C:\Windows\system32\cmd.exe

-  □  ×

Microsoft Windows [版本 10.0.17134.285]
(c) 2018 Microsoft Corporation。保留所有权利。

E:\>cd /d "E:\"

E:\>for /F "delims=" %i in ('dir /b /a-d *.txt') do (
echo Change name for file: %i
for /F "delims=" %j in ('powershell -c "'%~ni'.ToCharArray() -join '飞'" 2>nul') do (ren "%i" "%j%~xi" )
)

E:\>(
echo Change name for file: 0008.txt
for /F "delims=" %j in ('powershell -c "'0008'.ToCharArray() -join '飞'" 2>nul') do (ren "0008.txt" "%j.txt" )
)
Change name for file: 0008.txt

E:\>(ren "0008.txt" "0飞0飞0飞8.txt" )

E:\>(
echo Change name for file: 1.txt
for /F "delims=" %j in ('powershell -c "'1'.ToCharArray() -join '飞'" 2>nul') do (ren "1.txt" "%j.txt" )
)
Change name for file: 1.txt

E:\>(ren "1.txt" "1.txt" )

E:\>(
echo Change name for file: 11.txt
for /F "delims=" %j in ('powershell -c "'11'.ToCharArray() -join '飞'" 2>nul') do (ren "11.txt" "%j.txt" )
)
Change name for file: 11.txt

E:\>(ren "11.txt" "1飞1.txt" )

E:\>(
echo Change name for file: 新建文本文档.txt
for /F "delims=" %j in ('powershell -c "'新建文本文档'.ToCharArray() -join '飞'" 2>nul') do (ren "新建文本文档.txt" "%j.txt" )
)
Change name for file: 新建文本文档.txt

E:\>(ren "新建文本文档.txt" "新飞建飞文飞本飞文飞档.txt" )

E:\>
梦依旧在,只是,心有余而力渐有不足
年年岁岁花相似,岁岁年年人不同

TOP

返回列表