Batch Script: Rename Files with Folder Name in Windows
@echo off setlocal enabledelayedexpansion
for %%i in (.) do set 'folder=%%~nxi' echo Current folder name is: %folder%
for %%f in (*) do ( if not '%%~nxf'=='%~nx0' ( ren '%%~f' '%folder%%%~xf' ) )
echo All files have been renamed to %folder% successfully. pause>nul
原文地址: https://www.cveoy.top/t/topic/nLwJ 著作权归作者所有。请勿转载和采集!