用bat编写一个将当前文件夹下的文件和子文件夹下的文件全部重命名成当前文件夹一样的名称
@echo off setlocal enabledelayedexpansion
set "folder=%cd%" set "newName=%~nx0"
for /r "%folder%" %%f in (*) do ( set "fullName=%%f" set "name=%%~nxf" set "path=%%~dpf" set "newPath=!path:%folder%=!%newName%" if not exist "!newPath!" md "!newPath!" ren "!fullName!" "!newName!" )
echo Renaming complete. pause>nul exit
原文地址: http://www.cveoy.top/t/topic/dTUa 著作权归作者所有。请勿转载和采集!