本帖最后由 qazplm 于 2020-3-22 17:27 编辑
- @echo off
- rem 有问题,可加QQ956535081及时沟通
- set "exefile=C:\Program Files\WinRAR\WinRAR.exe"
- if not exist "%exefile%" (echo;"%exefile%" not found&goto end)
- for /f "delims=" %%a in ('dir /a-d/b/s *.rar ') do (
- echo;"%%a"
- "%exefile%" x -ibck -y "%%a" "%%~dpa#%%~na\"
- if not exist "%%~dpa%%~na\" md "%%~dpa%%~na\"
- for /f "delims=" %%b in ('dir /a-d/b/s "%%~dpa#%%~na\" 2^>nul') do (
- call :loop "%%b" "%%~dpa%%~na\" "%%~na"
- )
- rd /s /q "%%~dpa#%%~na\"
- )
- :end
- cd /d "%~dp0"
- pause
- exit
- :loop
- set n=2
- set "newfile=%~2\%~3%~x1"
- :check
- if not exist "%newfile%" (goto break)
- set "newfile=%~2\%~3-%n%%~x1"
- set /a n+=1
- goto check
- :break
- move "%~1" "%newfile%"
- exit/b
复制代码
|