指定字符串批量 "替換 文件名[包括子目錄]"

@echo off
REM 使用 UTF-8
chcp 65001

Setlocal enabledelayedexpansion
Set "BeforeStr=MyDemo"
Set "AfterStr=WinTest"

For /r %%# in (*) Do (
Set "File=%%~nx#"
Ren "%%#" "!File:%BeforeStr%=%AfterStr%!"
)

Pause

 

使用演示

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章