本帖最后由 zaqmlp 于 2019-6-9 10:07 编辑
密码一行一个输入到password.txt,将bat、txt和压缩包放一起运行,注意备份源文件- @echo off
- mode con lines=3000
- set info=互助互利,支付宝扫码头像,感谢赞助
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- set "pw=password.txt"
- set "rarpath=C:\Program Files\WinRAR\WinRAR.exe"
- if not exist "%rarpath%" (echo;指定WinRAR的安装路径不正确或没有安装&pause&exit)
- if not exist "%pw%" (echo;密码文件不存在&pause&exit)
- for /f "delims=" %%a in ('dir /a-d/b *.rar *.zip') do (
- call :check "%%a"
- rd /s /q "%%~dpna\" 2>nul
- )
- echo;%info%
- pause&exit
- :check
- if not exist "%~dpn1\" md "%~dpn1\"
- set "f="
- "%rarpath%" x -p"" -ibck -y "%~1" "%~dpn1\"
- for /f "delims=" %%c in ('dir /a-d/b/s "%~dpn1\" 2^>nul') do set f=true
- if defined f (
- echo;["无密码"]"%~1"
- exit /b
- )
- for /f "delims=" %%b in ('type "%pw%"') do (
- "%rarpath%" x -p"%%b" -ibck -y "%~1" "%~dpn1\"
- for /f "delims=" %%c in ('dir /a-d/b/s "%~dpn1\" 2^>nul') do set f=true
- if defined f (
- echo;["%%b"]"%~1"
- del /a /f /q "%~1"
- "%rarpath%" a -r -ep1 -ibck "%~1" "%~dpn1\"
- exit /b
- )
- )
- echo;["找不到密码"]"%~1"
- exit /b
复制代码
|