- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /s /a-d ^| find /v "%~0"') do (
- set "folderName=%%~dpi"
- set "folderName=!folderName:~0,-1!"
- call :1 "!folderName!"
- ren "%%i" "!folderName!%%~nxi"
- )
- endlocal & pause & exit
- :1
- set "folderName=%~nx1"
- exit /b
复制代码
|