回复 17# 无情浪子哥
重新整理了一下,兼顾你的上一个帖子,移动并改名,可解决重名问题- @echo off
- setlocal enabledelayedexpansion
- for /d %%a in (*) do (
- pushd %%a
- for /f "delims=" %%i in ('dir /b /s /a-d') do (
- if not exist "%%a%%~nxi" (move "%%i" "%%a%%~nxi") else (
- if not exist "%%a%%~ni (2)%%~xi" (move "%%i" "%%a%%~ni (2)%%~xi") else (
- set n=2
- for %%j in ("%%a%%~ni (*)%%~xi") do (
- set "str=%%~nj"
- set "m=!str:%%a%%~ni (=!"
- set "m=!m:)=!"
- if !m! gtr !n! set /a n=m
- )
- set /a n+=1
- move "%%i" "%%a%%~ni (!n!)%%~xi"
- )
- )
- )
- popd
- )
- pause
复制代码
|