批量重命名文件夹及子文件夹中的文件为文件夹名称
@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
原文地址: https://www.cveoy.top/t/topic/nLvo 著作权归作者所有。请勿转载和采集!