bat批处理 文件夹名 把文件夹中特定字符批量更改为指定字符,谢谢

2024-12-04 06:54:51
推荐回答(3个)
回答1:

@echo off & setlocal enabledelayedexpansion
title BAT-GO团队奉献 http://zhidao.baidu.com/team/view/BAT-GO
set a=
set b=
set c=
set xz=
cls&echo 【1】替换sdfsfdsf_abcd 【2】替换oiewsdf
echo.
set /p a=你想替换什么字符,请选择1或2:
if "!a!"=="1" set b=sdfsfdsf_abcd
if "!a!"=="2" set b=oiewsdf
cls&set /p c=你想将!b!替换城什么字符:
for /f "delims=" %%a in ('dir /s /b /ad "*!b!*"') do (
set xz=%%a
echo 正在替换!xz!
move /y "!xz!" "!xz:%b%=%c%!" >nul 2>nul
)
echo OK!
pause

回答2:

@echo off& mode con cols=40 lines=10
setlocal enabledelayedexpansion& color 07
echo please type the old string& set /p wind_O=& echo.
echo please type the new string& set /p wind_N=& cls
for /d %%1 in (*)do (set wind=%%1
rename "!wind!" "!wind:%wind_O%=%wind_N%!")

回答3:

用工具来做比较简单,也比较自由,谷歌搜索“灵者更名”