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