批量删除文件名中包含 "diffusionImage" 字符的部分

使用方法:

  1. 创建一个txt文件
  2. 黏贴代码 保存
  3. 将后缀 txt改为 bat 运行
@echo off
setlocal enabledelayedexpansion

set "targetFolder=C:\Users\Lenovo\Desktop\thumbnail"  REM 替换目标文件夹路径

cd /d "%targetFolder%"

for %%F in (*diffusionImage*) do (
    set "filename=%%~nF"
    set "extension=%%~xF"
    set "newFilename=!filename:diffusionImage=!"
    ren "%%F" "!newFilename!!extension!"
    echo Renamed: "%%F" to "!newFilename!!extension!"
)

echo All files with 'diffusionImage' in their names have been renamed.
pause
最后修改于:2023-09-15 23:57
文章链接: https://oct.cn/view/176
版权声明: 本站所有文章除特别声明外。转载请注明来自 十月笔记