本帖最后由 fzp070 于 2022-8-19 17:28 编辑
回复 17# holley
将"%%~dpni.zip" 改成"%cd%\已转换zip\%%~ni.zip",另外for查找范围改成*.7z *.rar *.zip,刚已试OK,你试下- @echo off
- mkdir "%~dp0原压缩包"
-
- echo. 读取文本密码
- for /f "delims=" %%x in ('TYPE pw.txt')do (set pw=%%x &call :chpw)
-
- cls
- ::setlocal disabledelayedexpansion
- color c7
- echo.&echo.&echo 运行结束,如有剩余【未解压转换zip】的7z与rar文件,请检查密码的正确性,以及密码是否含""引号 &echo.&echo.
- rd ~Tmp /s /q >nul 2>nul
- TIMEOUT /T 3 /NOBREAK
- exit
-
-
- :chpw
- echo. 7z转换zip
- path "%ProgramFiles%\7-Zip";%path%
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d *.7z *.rar *.zip') do (set zf=%%i
- 7z x "!zf!" -p!pw! -o"%~dp0~Tmp" -aoa &&7z a "%cd%\已转换zip\%%~ni.zip" "%~dp0~Tmp\*" -y -sdel &&move "!zf!" "%cd%\原压缩包\"
- rd ~Tmp /s /q >nul 2>nul
- )
- (for /f "delims=" %%a in ('dir /b /a-d *.7z *.rar *.zip') do set zf2=%%a)>nul 2>nul
- if "%zf2%"=="" goto ok
- goto :eof
-
-
- :ok
- cls
- ::setlocal disabledelayedexpansion
- color b1
- echo.&echo.&echo 【7z转换zip已全部完成】&echo.&echo.
- TIMEOUT /T 3 /NOBREAK
- exit
复制代码
|