- @echo off
- set "password=固定密码"
- set "exefile=C:\Program Files\WinRAR\WinRAR.exe"
- set ext=*.zip
- if not exist "%exefile%" (echo;"%exefile%" not found&pause&exit)
- for /f "delims=" %%a in ('dir /a-d-h/b/s %ext%') do (
- "%exefile%" x -y -p"test" "%%a" "%%~dpa~tmp\%%~na\"
- set "f="
- if exist "%%~dpa~tmp\%%~na\" (
- for /f "delims=" %%b in ('dir /a-d/b/s "%%~dpa~tmp\%%~na\" 2^>nul') do set /a f+=1
- )
- if defined f (
- del /a /f /q "%%a"
- "%exefile%" a -y -r -ep1 -p"%password%" "%%a" "%%~dpa~tmp\%%~na\*.*"
- echo;"%%a"
- )
-
- rd /s /q "%%~dpa~tmp\" 2>nul
- )
- pause
- exit
复制代码
|