本帖最后由 terse 于 2023-5-16 08:33 编辑
修正一下 加个循环加个循环- @echo off&setlocal enabledelayedexpansion
- set "folder=新建文件夹 (8)"
- for /f "delims=" %%a in ('dir /ad /b "%folder%"') do (
- for /f %%b in ('dir /b /ad "%folder%\%%a"') do (
- for %%c in ("%folder%\%%a\%%b\%%b-*-*.*") do (
- set "str=%%~nxc"
- ren "%%c" "!str:*%%b-=!"
- )
- )
- )
- pause
复制代码 不用DIR- @echo off&setlocal enabledelayedexpansion
- set "folder=新建文件夹 (8)"
- for /d %%a in ("%folder%\*") do (
- for /d %%b in ("%%a\*") do (
- for %%c in ("%%b\%%~nb-*-*.*") do (
- set "str=%%~nxc"
- ren "%%c" "!str:*%%~nb-=!"
- )
- )
- )
- pause
复制代码
|