基本命令如下:
ren "2015 0210 ?????????? ???? X 02".* "2015 0210 ?????????? 0746 A 02".*
語法:
@echo off
::help
::YMD = 找尋欲變更檔名的開頭年月日,輸入 "2015 0210"
::OLD = 找尋欲變更檔名的結尾,輸入 "X 02"
::NEW = 欲變更檔名的結尾,輸入 "0746 A 02"
::使用範例 C:\>ren-4x "2015 0210" "x 02" "0746 A 02"
:main
set "YMD=%1"
set "YMD=%YMD:~1,9%"
set "OLD=%2"
set "OLD=%OLD:~1,4%"
set "NEW=%3"
set "NEW=%NEW:~1,9%"
ren "%YMD% ?????????? ???? %OLD%".* "%YMD% ?????????? %NEW%".*
::echo "%YMD% ?????????? ???? %OLD%".* "%YMD% ?????????? %NEW%".*
pause