如何用cmd按规则批量修改文件名

发布网友 发布时间:2022-03-19 00:05

我来回答

1个回答

热心网友 时间:2022-03-19 01:51

@echo off&setlocal enabledelayedexpansion
cd /d %~dp0
if not exist se_b md se_b
for /f "delims=" %%a in ('dir /a-d/s/b se_*') do (
    set Dir=%%~dpa
    call:GetDirName "!Dir:~,-1!"
    move "%%~a" "se_b\!str!%%~xa"
)
for /f "delims=" %%a in ('dir /a-d/s/b b_*') do (
    set Dir=%%~dpa
    call:GetDirName "!Dir:~,-1!"
    set File=%%~nxa
    ren "%%~a" "!str!!File:~1!"
)
pause
exit
:GetDirName
set str=%~nx1

放在那些文件夹一起后运行。

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com