@echo off
if /i "%UserName%" == "SYSTEM" (Goto GotAdmin) else (reg query "HKLM\SYSTEM\ControlSet001\Control\MiniNT" 1>nul 2>nul&&Goto GotAdmin)
:BatchGotAdmin
Set _Args=&Set Args=%*
if `%1` neq `` Set "_Args=%Args:"=""%"
if exist %WinDir%\System32\fltMC.exe fltMC 1>nul 2>nul||mshta VBScript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c """"%~f0"" %_Args%""",,"runas",1)(Window.Close) 2>nul&&Exit /b

:GotAdmin
Pushd "%CD%"&cd /d "%~dp0"
reg /? 1>nul 2>nul||(Call :EchoX "cf.: 找不到 reg.exe 文件。"&Call :Delay 5 +&Exit /b)
findstr /? 1>nul 2>nul||(Call :EchoX "cf.: 找不到 findstr.exe 文件。"&Call :Delay 5 +&Exit /b)
Set "Mode=if exist %WinDir%\System32\ureg.dll Mode"&Set "echo=echo.&echo.&echo        "&Set "-=---------------------------------------------------------------------------------"
Set "ImgExt=*.emf *.wmf *.jpg *.jpeg *.jfif *.jpe *.png *.bmp *.dib *.rle *.gif *.emz *.wmz *.pcz *.tif *.tiff *.eps *.pct *.pict *.wpg" :: 提取图片过滤字符串
Set "DocExt=.docx .xlsx .pptx .ofd .chm" :: 支持提取图片的文档格式
Set "SdcExt=7z rar rar5" :: 支持获取根列表的压缩格式
Set Sfx=&Set Exc=&Set Exz=&Set Exd=&Set pass=&Set mhe=&Set archive=

:Init :: 参数修改后，需要重新安装右键菜单
REM 调用EXE
Set "Bat=%~dpnx0"
if defined CommonProgramW6432 (Set bit=x64) else Set bit=x86
if exist bin\7z.sfx Set "Sfx=%~dp0bin\7z.sfx"
if exist bin\%bit%\7za.exe Set "Exc=%~dp0bin\%bit%\7za.exe"
if exist bin\%bit%\7z.exe if exist bin\%bit%\7z.dll Set "Exc=%~dp0bin\%bit%\7z.exe"
if not defined Sfx Color cf&echo 未定义变量 %%Sfx%%，按任意键退出 。。。&Call :Delay 5&Exit /b
if not defined Exc Color cf&echo 未定义变量 %%Exc%%，按任意键退出 。。。&Call :Delay 5&Exit /b
if exist bin\nop.exe (Set "Nop=%~dp0bin\nop.exe") else Set "Nop=alg.exe"
if exist bin\list.exe (Set "List=%~dp0bin\list.exe") else Set List=
if exist bin\HideRun.exe (Set "HideRun=%~dp0bin\HideRun.exe") else Set HideRun=
REM 7z关联图标、右键菜单图标
Set "FIcon=icon\文件图标.ico,0"                 :: 文件图标
Set "MIcon=icon\菜单图标.ico,0"                 :: 菜单图标
(if exist 7z.dll Set "FIcon=7z.dll,0")&(if exist 7zFM.exe Set "MIcon=7zFM.exe,0")
REM 解压缩选项
:: Set "Exz=Exc"                                :: 压缩强制使用命令行 (取消则注释)
Set "Exd=Exc"                                   :: 解压缩强制使用命令行 (取消则注释)
:: Set "pass=压缩密码"&                         :: 设置统一解压缩密码，本机解压无需密码 (不支持字符 " % ^ & | < >)
:: Set "mhe=on"                                 :: 启用加密文件名
:: Set "archive=%%%%~dpni.7z"                   :: 设置档案文件名 (不包含文件扩展名)
if not defined archive Set "archive=%%%%~i.7z"  :: 默认档案文件名
Set mm=&Set pstr=&Set mstr=&if defined pass Set "mm= [*]"&Set "pstr= -p"%pass%""&if /i "%mhe%" == "on" Set "mstr= -mhe=%mhe%"
Set "Exz=%Exc%"&if /i "%Exz%" neq "Exc" if exist bin\%bit%\7zG.exe if exist bin\%bit%\7z.dll Set "Exz=%~dp0bin\%bit%\7zG.exe"
Set zn=25&Set "$=@start "" "&if /i "%Exz%" == "%Exc%" Set zn=28&Set $=
Set "Exd=%Exz%"&if /i "%Exd%" == "Exc" Set "Exd=%Exc%"
Set dn=25&Set dstr=&if /i "%Exd%" == "%Exc%" Set dn=28&Set "dstr= -y -bb"
REM 判断输入参数
Set hint=启用提示
if /i "%~1" == "install" Set hint=&Goto Install
if /i "%~1" == "uninsta" Set hint=&Goto UnInsta
if /i "%~1" == "makesfx" Set hint=&Goto MakeSfx
if /i "%~1" == "extrimg" Set hint=&Goto ExtrImg
if /i "%~1" == "smartdc" Set hint=&Goto SmartDc
if /i "%~1" == "stdcdel" Set hint=&Goto StDcDel
if /i "%~1" == "extract" Set hint=&Goto Extract
if /i "%~1" == "extrdel" Set hint=&Goto ExtrDel
if /i "%~1" == "ulticom" Set hint=&Goto UltiCom

:Start
Title 7z极限压缩%mm%&%Mode% 39,6 2>nul
reg query "HKCR\Folder\Shell\7zUC" 1>nul 2>nul&&Goto UnInsta||Goto Install

:Install
Color 9f&if defined hint %echo% 正在添加右键菜单 。。
echo "%~dp0"|findstr /c:"%%" 1>nul 2>nul&&(Cls&Color cf&%echo% 错误: 不支持带 %% 路径 ！！&Call :Delay 5&Exit /b)
Set "Bat=%Bat:&=^&%"&Set "Sfx=%Sfx:&=^&%"&Set "Exc=%Exc:&=^&%"&Set "Exz=%Exz:&=^&%"&Set "Exd=%Exd:&=^&%"&if defined pstr Set "pstr=%pstr:"=\"%"
Call :RMenu_7zIE *
Call :RMenu_7zUC *
Call :RMenu_7zUC Folder
reg add "HKLM\SOFTWARE\Classes\.7z" /f /ve /t REG_SZ /d "7-Zip.7z" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\7-Zip.7z" /f /ve /t REG_SZ /d "7z 档案文件" 1>nul 2>nul
reg query "HKLM\SOFTWARE\Classes\7-Zip.7z\DefaultIcon" /ve 1>nul 2>nul||reg add "HKLM\SOFTWARE\Classes\7-Zip.7z\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
if defined hint Cls&%echo% 右键菜单添加完成 ！！
Goto End

:UnInsta
Color 8f&if defined hint %echo% 正在删除右键菜单 。。
for %%i in ("HKCU" "HKLM") do (
    reg delete "%%~i\SOFTWARE\Classes\*\Shell\7zIE" /f 1>nul 2>nul
    reg delete "%%~i\SOFTWARE\Classes\*\Shell\7zUC" /f 1>nul 2>nul
    reg delete "%%~i\SOFTWARE\Classes\Folder\Shell\7zUC" /f 1>nul 2>nul
    reg query "%%~i\SOFTWARE\Classes\7-Zip.7z\Shell\Open\Command" 1>nul 2>nul||(reg delete "%%~i\SOFTWARE\Classes\.7z" /f 1>nul 2>nul&reg delete "%%~i\SOFTWARE\Classes\7-Zip.7z" /f 1>nul 2>nul)
)
if defined hint Cls&%echo% 右键菜单删除完成 ！！
Goto End

:End
assoc .=. 1>nul 2>nul&reg delete "HKCR\." /f 1>nul 2>nul
if defined hint Call :Delay 2
cd.&Set hint=&Exit /b

:MakeSfx :: 转换自解压程序: 7z极限压缩.bat MakeSfx "7z转换自解压程序" "%~3"
(%Mode% 82,18 2>nul)&Color 2f&Title 7-Zip 极限压缩 -^> [ %~2 ] -^> @%time:~0,-3%
if not exist "%~3" Call :EchoX "cf::找不到文件！" "xx.:↓"&echo "%~3"&Call :Delay 5&Exit /b
for %%i in ("%~3") do Set "File=%%~dpni.exe"&if /i "%%~xi" neq ".7z" Call :EchoX "cf::不支持非 7z 格式！" "xx.:↓"&echo "%~3"&Call :Delay 5&Exit /b
echo 生成文件: ↓&echo %File:&=^&%&echo %-%&echo.
copy /b "%Sfx%" + "%~3" "%File%"
if ErrorLevel 1 (Color cf&echo.&echo %-%&Set /p=_☆☆[ メ转换失败！]☆☆<nul&Call :Delay 9 +) else Color 9f&echo.&echo %-%&Set /p=_☆☆[ √转换完成！]☆☆<nul&Call :Delay 3 +
Exit /b

:ExtrImg :: 提取文档图片: 7z极限压缩.bat ExtrImg "%~2"
(%Mode% 82,23 2>nul)&Color 2f&Title 7-Zip 极限压缩 -^> [ 提取文档图片 ] -^> @%time:~0,-3%
if not exist "%~2" Call :EchoX "cf::找不到路径！" "xx.:↓"&echo "%~2"&Call :Delay 5&Exit /b
Set "File=%~2"&Set "Ext=%~x2"&Set "PDir=%~dp2"&Set "ImgDir=%~nx2_图片"
echo "%DocExt: =;%;"|findstr /i /c:"%Ext%;" 1>nul 2>nul||(Call :EchoX "cf.:不支持的文档格式！！"&Call :Delay 5&Exit /b)
mkdir "%PDir%%ImgDir%" 2>nul&if not exist "%PDir%%ImgDir%" Call :EchoX "cf.:创建图片文件夹失败，请检查是否有写权限！"&Call :Delay 5&Exit /b
:: "%Exd%" e "%File%" %ImgExt% -o"%PDir%%ImgDir%" -r%dstr%
"%Exc%" e "%File%" %ImgExt% -o"%PDir%%ImgDir%" -r -y -bb
if ErrorLevel 1 (Color cf&echo.&echo %-%&echo ^>^> "%PDir%%ImgDir%"&Set /p=_☆☆[ メ提取失败！]☆☆<nul&echo.&echo %-%&Call :Delay 9 +) else Color 9f&echo.&echo %-%&echo ^>^> "%PDir%%ImgDir%"&Set /p=_☆☆[ √提取完成！]☆☆<nul&echo.&echo %-%&Call :Delay 3 +
Exit /b

:StDcDel :: 智能解压到文件夹成功后，删除源文件
:SmartDc :: 智能解压到文件夹: 7z极限压缩.bat <SmartDc|StDcDel> <Judge|MkDir> "智能解压到文件夹" "%~4" ["%~5"]
(%Mode% 82,%dn% 2>nul)&Color 2f&Title 7-Zip 解压缩%mm% -^> [ %~3 ]
if not exist "%~4" (Call :EchoX "cf::错误：解压文件不存在！" "xx.:↓"&echo "%~4"&Call :Delay 5&Exit /b) else Set "File=%~4"
cd /d "%File%" 2>nul&&(Call :EchoX "cf::错误：此操作项不是文件！" "xx.:↓"&echo "%File%"&Call :Delay 5&Exit /b)||for %%i in ("%File%") do Set "File_=%%~si"&Set "PDir=%%~dpi"&Set "Name=%%~ni"
Set Desk=&for /f "tokens=2*" %%i in ('reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop" 2^>nul') do Set "Desk=%%~j"
Set PVar=&(if "%~5" neq "" Set "PVar=%~5")&Set "Jump=SJ"&Goto DRSpac
:SJ
if /i "%~5" == "Desktop" Set "PVar=%Desk%"
if defined PVar mkdir "%PVar%" 2>nul&cd /d "%PVar%" 2>nul&&Set "PDir=%PVar%"
cd /d "%~dp0"&if "%PDir:~-1%" neq "\" Set "PDir=%PDir%\"
Set type=&for /f "tokens=1* delims== " %%i in ('1^>nul 2^>nul echo.^|"%Exc%" l "%File%"%pstr%^|findstr /c:"Type = "') do if not defined type Set "type=%%~j"
if not defined type Color cf&echo %-%&echo  错误: 无法将文件作为存档打开 !!!                             │&echo        ↓若为加密存档，请输入密码 → 注意: 不支持字符 ^" ^^ —  │&echo --------------------------------------------------------------╯&Set /p="_ >>>>: "<nul&Set pass=&Set /p pass=
Setlocal EnableDelayedExpansion
if not defined type if defined pass Set "pass=!pass:>=^>!"&Set "pass=!pass:<=^<!"&Set "pass=!pass:&=^&!"&Set "pass=!pass:|=^|!"
Endlocal&Set "pass=%pass%"
if not defined type if not defined pass (Exit /b) else Set "pstr= -p"%pass%""&Goto SmartDc
Title 7-Zip 解压缩%mm% -^> [ %~3 ] -^> [ 存档类型 %type% ] -^> @%time:~0,-3%
echo.&echo ^>^> 压缩包类型为 [%type%]↓&echo 　　%File:&=^&%&Set rest=9f3√解压完成！
:Judge
echo.&echo ^>^> 开始获取列表，判断是否需要创建文件夹
Set dest=&for /f "delims=" %%i in ('1^>nul 2^>nul echo.^|"%Exc%" l -slt "%File%"%pstr%^|findstr /c:"Path = "^|findstr /v "[\\/:]"') do Call :JLoop "%%~i"
Set cstr=&if defined pass Set cstr="%pass%"
if defined List Set dest=&for /f "delims=" %%i in ('1^>nul 2^>nul echo.^|"%List%" "%Exc%" "%File%" %cstr%') do Call :JLoop "Path = %%~i"
if defined List if defined dest echo.&echo ^>^> 没有零散文件，无需创建根文件夹&Set "Root=%PDir%"&Goto UnZip
if /i "%~2" == "Judge" if defined dest for %%i in (%SdcExt%) do if /i "%type%" == "%%~i" echo.&echo ^>^> 没有零散文件，无需创建根文件夹&Set "Root=%PDir%"&Goto UnZip
Set "Rand=%Random:~-1%%Random:~-1%%Random:~-1%%Random:~-1%%Random:~-1%%Random:~-1%"
echo.&echo ^>^> 创建临时解压文件夹&Set "Root=%PDir%%Name%_解压中@%Rand%!"&Goto MkDir
:JLoop
Set "item=%~1"
if not defined dest for /f "tokens=1* delims=\/" %%i in ('echo "%item:~7%"') do Set "dest=%%~i"
for /f "tokens=1* delims=\/" %%i in ('echo "%item:~7%"') do Set "item=%%~i"&if "%dest%" == "%%~i" Goto :eof
echo.&echo ^>^> 存在零散文件，准备创建根文件夹&Set "Root=%PDir%%Name%"
:MkDir
for %%i in ("%Root%") do Set "RName=%%~nxi"
if exist "%Root%" Call :EchoX "xx::　 " "70::文件夹已存在，是否覆盖解压？" "xx.:↓"&echo 　　%Root:&=^&%&(cd /d "%Root%" 2>nul||Call :EchoX "xx::    " "cf.:(↑检测到目标是文件，覆盖则删除！)")&Call :EchoX "xx::　 [" "e0::直接回车覆盖" "xx::] | [" "b0::任意键回车取消" "xx::] : "&Set rest=9f3√覆盖解压！&Set key=&Set /p key=
if exist "%Root%" if defined key Set rest=b03ㄨ取消覆盖！&Goto UEnd
cd /d "%Root%" 2>nul||del /f /q "%Root%" 1>nul 2>nul
mkdir "%Root%" 2>nul&cd /d "%Root%" 2>nul&&(cd /d "%~dp0"&Set err=)||Set err=1
if defined err Color cf&echo 　 创建文件夹ㄨ　%RName:&=^&%&Call :Delay 5&Exit
echo 　 创建文件夹√　%RName:&=^&%&Set "Root=%Root%\"
:UnZip
echo.&echo ^>^> 开始智能解压
if "%Root%" == "%PDir%" if defined dest if exist "%Root%%dest%" Call :EchoX "xx::　 " "70::解压目标已存在，是否覆盖解压？" "xx.:↓"&echo 　　%Root:&=^&%%dest:&=^&%&Call :EchoX "xx::　 [" "e0::直接回车覆盖" "xx::] | [" "b0::任意键回车取消" "xx::] : "&Set rest=9f3√覆盖解压！&Set key=&Set /p key=
if "%Root%" == "%PDir%" if defined dest if exist "%Root%%dest%" if defined key Set rest=b03ㄨ取消覆盖！&Goto UEnd
if "%Root%" == "%PDir%" if defined dest if exist "%Root%%dest%" cd /d "%Root%%dest%" 2>nul||del /f /q "%Root%%dest%" 1>nul 2>nul
if not defined dstr echo.&Call :EchoX "xx::>> " "70::正在打开 7z GUI 解压文件" "xx.:↓"
"%Exd%" x "%File%" -o"%Root%"%dstr%%pstr%||(Set rest=cf9ㄨ解压失败！&Goto UEnd)
if "%Root%" neq "%PDir%%Name%_解压中@%Rand%!\" Goto UEnd
echo.&echo ^>^> 已解压到临时文件夹↓
ren "%Root:~0,-1%" "%Name%_已解压@%Rand%!" 1>nul 2>nul&Set "Root=%PDir%%Name%_已解压@%Rand%!\"&echo 　 %Name:&=^&%_已解压@%Rand%!
Set n=0&Set item=&for /f "delims=" %%i in ('dir /a /b "%Root%"') do Set "item=%%~i"&Set /a n+=1
if not defined item rmdir "%Root%" 1>nul 2>nul&Goto UEnd
if %n% == 0 rmdir "%Root%" 1>nul 2>nul&Goto UEnd
if %n% gtr 1 (Goto MultiItem) else Set key=
if exist "%PDir%%item%" echo.&Call :EchoX "xx::>> " "70::解压目标已存在，是否替换？" "xx.:↓"&echo 　　%PDir:&=^&%%item:&=^&%&Call :EchoX "xx::　 [" "e0::直接回车，删除替换" "xx::] | [" "e0::空格回车，覆盖替换" "xx::] | [" "b0::其他键回车，取消替换" "xx::] : "&Set rest=9f3√删除替换！&Set /p key=
if not defined key del /f /q "%PDir%%item%" 1>nul 2>nul&rd /s /q "%PDir%%item%" 1>nul 2>nul&move /y "%Root%%item%" "%PDir%%item%" 1>nul 2>nul&rmdir "%Root%" 1>nul 2>nul&Goto UEnd
if /i "%key%" == " " (
    xcopy /? 1>nul 2>nul||(Color cf&echo.&echo 　　找不到 xcopy.exe 文件，按任意键退出 。。。&Call :Delay 5&Exit /b)
    cd /d "%PDir%%item%" 2>nul||del /f /q "%PDir%%item%" 1>nul 2>nul
    cd /d "%Root%%item%" 2>nul&&(echo d|xcopy /e /h /r /y "%Root%%item%" "%PDir%%item%" 1>nul 2>nul)||(cd /d "%~dp0"&rd /s /q "%PDir%%item%" 1>nul 2>nul&echo f|xcopy /e /h /r /y "%Root%%item%" "%PDir%%item%" 1>nul 2>nul)
    cd /d "%~dp0"&del /f /q "%Root%%item%" 1>nul 2>nul&rd /s /q "%Root%%item%" 1>nul 2>nul&rmdir "%Root%" 1>nul 2>nul&Set rest=9f3√覆盖替换！&Goto UEnd
)
Set rest=b03ㄨ取消替换！&Goto UEnd
:MultiItem
if not defined Name (Goto UEnd) else Set key=
if exist "%PDir%%Name%" echo.&Call :EchoX "xx::>> " "70::解压目标已存在，是否删除并替换？" "xx.:↓"&echo 　　%PDir:&=^&%%Name:&=^&%&Call :EchoX "xx::　 [" "e0::直接回车，删除替换" "xx::] | [" "e0::空格回车，覆盖替换" "xx::] | [" "b0::其他键回车，取消替换" "xx::] : "&Set rest=9f3√删除替换！&Set /p key=
if not defined key del /f /q "%PDir%%Name%" 1>nul 2>nul&rd /s /q "%PDir%%Name%" 1>nul 2>nul&ren "%Root:~0,-1%" "%Name%" 1>nul 2>nul&Goto UEnd
if /i "%key%" == " " (
    xcopy /? 1>nul 2>nul||(Color cf&echo.&echo 　　找不到 xcopy.exe 文件，按任意键退出 。。。&Call :Delay 5&Exit /b)
    cd /d "%PDir%%Name%" 2>nul||del /f /q "%PDir%%Name%" 1>nul 2>nul
    echo d|xcopy /e /h /r /y "%Root:~0,-1%" "%PDir%%Name%" 1>nul 2>nul
    cd /d "%~dp0"&rd /s /q "%Root%" 1>nul 2>nul&Set rest=9f3√覆盖替换！&Goto UEnd
)
Set rest=b03ㄨ取消替换！
:UEnd
Set di=&if /i "%~1" == "stdcdel" if /i "%rest:~3,1%" == "√" del /f /q "%File%" 1>nul 2>nul&if not exist "%File%" Set "di= (已删除)"
Color %rest:~0,2%&echo.&echo %-%&echo ^>^> "%File%"%di%&echo ^>^> "%Root%"&Set /p=_☆☆[ %rest:~3%]☆☆<nul&echo.&echo %-%&Call :Delay %rest:~2,1% +&Exit

:ExtrDel :: 解压到文件夹成功后，删除源文件
:Extract :: 解压到文件夹: 7z极限压缩.bat <Extract|ExtrDel> "解压到文件夹" "%~3" ["%~4"]
(%Mode% 82,%dn% 2>nul)&Color 2f&Title 7-Zip 解压缩%mm% -^> [ %~2 ]
if not exist "%~3" (Call :EchoX "cf::错误：解压文件不存在！" "xx.:↓"&echo "%~3"&Call :Delay 5&Exit /b) else Set "File=%~3"
cd /d "%File%" 2>nul&&(Call :EchoX "cf::错误：此操作项不是文件！" "xx.:↓"&echo "%File%"&Call :Delay 5&Exit /b)||for %%i in ("%File%") do Set "PDir=%%~dpi"&Set "Name=%%~ni"
Set Desk=&for /f "tokens=2*" %%i in ('reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop" 2^>nul') do Set "Desk=%%~j"
Set PVar=&(if "%~4" neq "" Set "PVar=%~4")&Set "Jump=EJ"&Goto DRSpac
:EJ
(if /i "%~4" == "ArchDir" Set "PVar=%PDir%%Name%")&(if /i "%~4" == "Desktop" Set "PVar=%Desk%")
if defined PVar mkdir "%PVar%" 2>nul&cd /d "%PVar%" 2>nul&&Set "PDir=%PVar%"
cd /d "%~dp0"&if "%PDir:~-1%" neq "\" Set "PDir=%PDir%\"
Set type=&for /f "tokens=1* delims== " %%i in ('1^>nul 2^>nul echo.^|"%Exc%" l "%File%"%pstr%^|findstr /c:"Type = "') do if not defined type Set "type=%%~j"
if not defined type Color cf&echo %-%&echo  错误: 无法将文件作为存档打开 !!!                             │&echo        ↓若为加密存档，请输入密码 → 注意: 不支持字符 ^" ^^ —  │&echo --------------------------------------------------------------╯&Set /p="_ >>>>: "<nul&Set pass=&Set /p pass=
Setlocal EnableDelayedExpansion
if not defined type if defined pass Set "pass=!pass:>=^>!"&Set "pass=!pass:<=^<!"&Set "pass=!pass:&=^&!"&Set "pass=!pass:|=^|!"
Endlocal&Set "pass=%pass%"
if not defined type if not defined pass (Exit /b) else Set "pstr= -p"%pass%""&Goto Extract
Title 7-Zip 解压缩%mm% -^> [ %~2 ] -^> [ 存档类型 %type% ] -^> @%time:~0,-3%
echo.&echo ^>^> 压缩包类型为 [%type%]↓&echo 　　%File:&=^&%
if not defined dstr echo.&Call :EchoX "xx::>> " "70::正在打开 7z GUI 解压文件" "xx.:↓"
"%Exd%" x "%File%" -o"%PDir%"%dstr%%pstr%&&Set rest=9f3√解压完成！||Set rest=cf9ㄨ解压失败！
Set di=&if /i "%~1" == "extrdel" if /i "%rest:~3,1%" == "√" del /f /q "%File%" 1>nul 2>nul&if not exist "%File%" Set "di= (已删除)"
Color %rest:~0,2%&echo.&echo %-%&echo ^>^> "%File%"%di%&echo ^>^> "%PDir%"&Set /p=_☆☆[ %rest:~3%]☆☆<nul&echo.&echo %-%&Call :Delay %rest:~2,1% +&Exit

:UltiCom :: 极限压缩，命令行调用
if "%~2" == "" (Exit /b) else Goto %~2
:NoDir :: 7z极限压缩.bat UltiCom NoDir "GUI设置：9-极限压缩 不含目录" "9" "%~5"
(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ %~3 ] -^> @%time:~0,-3%
Set mx=9&for %%i in (0 1 3 5 7 9) do if /i "%~4" == "%%~i" Set "mx=%~4"
if not exist "%~5" Call :EchoX "cf::错误: 找不到路径！" "xx.:↓"&echo "%~5"&Call :Delay 5&Exit /b
cd /d "%~5" 2>nul&&(Set "PDir=%~5")||(Call :EchoX "cf::错误: 此操作项不是目录！" "xx.:↓"&echo "%~5"&Call :Delay 5&Exit /b)
if "%PDir:~-1%" == "\" Set "PDir=%PDir:~0,-1%"
Call :EchoX "xx::>> " "70::压缩列表" "xx.:↓"
echo 　 [%PDir:&=^&%]
Setlocal EnableDelayedExpansion
Set n=0&for /f "delims=" %%i in ('dir /a /b 2^>nul') do Set /a n+=1&if !n! leq 10 echo 　 %%i
Endlocal&echo 　 . . .
echo.&if not exist "%PDir%.7z" Call :EchoX "xx::>> " "70::压缩文件" "xx.:↓"&echo 　　%PDir:&=^&%.7z&echo.
if exist "%PDir%.7z" Call :EchoX "xx::>> " "70::压缩包文件已存在，是否更新？" "xx.:↓"&echo 　　%PDir:&=^&%.7z&Call :EchoX "xx::　 [" "e0::直接回车更新" "xx::] | [" "b0::任意键回车取消" "xx::] : "&Set key=&Set /p key=
if exist "%PDir%.7z" if defined key (Exit /b) else echo.
if defined $ Call :EchoX "xx::>> " "70::正在打开 7z GUI 压缩文件" "xx.:↓"
%$%"%Exz%" a -t7z -snl -mx=%mx% -bb%pstr%%mstr% "%PDir%.7z"
if defined $ Call :Delay 1&Exit /b
if ErrorLevel 1 (Color cf&echo.&echo %-%&echo ^>^> "%PDir%.7z"&Set /p=_☆☆[ メ压缩失败！]☆☆<nul&del /q "%PDir%.7z.tmp*" 1>nul 2>nul&echo.&echo %-%&Call :Delay 9 +) else Color 9f&echo.&echo %-%&echo ^>^> "%PDir%.7z"&Set /p=_☆☆[ √压缩完成！]☆☆<nul&echo.&echo %-%&Call :Delay 3 +
Exit /b
:General :: 7z极限压缩.bat UltiCom General "GUI设置：9-极限压缩" "9" "%~5" ["%~6" ...]
:LZMA    :: 7z极限压缩.bat UltiCom LZMA  "单线程 LZMA 128M" "128m" "%~5" ["%~6" ...]
:LZMA2   :: 7z极限压缩.bat UltiCom LZMA2 "多线程 LZMA2 128M" "128m" "%~5" ["%~6" ...]
:LBCJ2   :: 7z极限压缩.bat UltiCom LBCJ2 "多线程 LZMA2 128M f=BCJ2" "128m" "%~5" ["%~6" ...]
:Split   :: 7z极限压缩.bat UltiCom Split "按 500MB 分卷压缩为7z" "7|500m" "%~5" ["%~6" ...]
:ZIP     :: 7z极限压缩.bat UltiCom ZIP "最高等级压缩为zip" "9|Deflate64" "%~5" ["%~6" ...]
(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ %~3 ] -^> @%time:~0,-3%
Set "uc=%~2"&Set "m=%~4"&if "%~5" == "" (Exit /b) else Set "File=%~5"
Set "ext=.7z"&if /i "%uc%" == "ZIP" Set "ext=.zip"
if "%File:~-1%" == "\" Set "File=%File:~0,-1%"
if /i "%File%" == "%File:.[-out]!=%" (
    if not exist "%File%" Call :EchoX "cf::错误: 找不到路径！" "xx.:↓"&echo "%File%"&Call :Delay 5&Exit /b
    for %%i in ("%File%") do Set "PDir=%%~dpi"&Set "Out=%%~dpnxi%ext%"&Set File= "%%~nxi"
) else (
    for %%i in ("%File:.[-out]!=%") do Set "PDir=%%~dpi"&Set "Out=%%~dpnxi%ext%"&Set File=
)
cd /d "%PDir%" 2>nul&&(Shift&Shift&Shift&Shift&Shift&Set Multi=)||(Call :EchoX "cf::错误: 此操作项不是目录！" "xx.:↓"&echo "%PDir%"&Call :Delay 5&Exit /b)
:Loop
if "%~1" neq "" Set Multi=%Multi% "%~1"&Shift&Goto Loop
Call :EchoX "xx::>> " "70::压缩列表" "xx.:↓"
echo 　 [%PDir:&=^&%]
for %%i in (%File%%Multi%) do echo 　 %%i
echo.&if not exist "%Out%" Call :EchoX "xx::>> " "70::压缩文件" "xx.:↓"&echo 　　%Out:&=^&%&echo.
if exist "%Out%" Call :EchoX "xx::>> " "70::压缩包文件已存在，是否更新？" "xx.:↓"&echo 　　%Out:&=^&%&Call :EchoX "xx::　 [" "e0::直接回车更新" "xx::] | [" "b0::任意键回车取消" "xx::] : "&Set key=&Set /p key=
if exist "%Out%" if defined key (Exit /b) else echo.
if defined $ Call :EchoX "xx::>> " "70::正在打开 7z GUI 压缩文件" "xx.:↓"
if /i "%uc%" == "General" %$%"%Exz%" a -t7z -snl -mx=%m% -ms=on -mmt=on -bb%pstr%%mstr% "%Out%"%File%%Multi%
if /i "%uc%" == "LZMA" %$%"%Exz%" a -t7z -snl -mx=9 -myx -mmt=off -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA:d=%m%:fb=273:lc=8 -bb%pstr%%mstr% "%Out%"%File%%Multi%
if /i "%uc%" == "LZMA2" %$%"%Exz%" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -md=%m% -mfb=273 -bb%pstr%%mstr% "%Out%"%File%%Multi%
if /i "%uc%" == "LBCJ2" %$%"%Exz%" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -mf=BCJ2 -md=%m% -mfb=273 -bb%pstr%%mstr% "%Out%"%File%%Multi%
if /i "%uc%" == "Split" for %%i in ("" ".001" ".002" ".003" ".004" ".005" ".006" ".007" ".008" ".009" ".010") do if exist "%Out%%%~i" Call :EchoX "xx::>> " "70::压缩分卷已存在，但不支持多卷档案的更新。" "xx.:↓"&echo 　　%Out:&=^&%%%~i&Call :EchoX "xx::　 [" "e0::手动删除后重新操作，或任意键取消" "xx::] : "&Pause >nul&Exit /b
if /i "%uc%" == "Split" %$%"%Exz%" a -snl -mx=%m:~0,1% -ms=on -mmt=on -v%m:~2% -bb%pstr%%mstr% "%Out%"%File%%Multi%
if /i "%uc%" == "ZIP" %$%"%Exz%" a -tzip -mx=%m:~0,1% -mm=%m:~2% -mmt=on -bb%pstr%%mstr% "%Out%"%File%%Multi%
if defined $ Call :Delay 1&Exit /b
if ErrorLevel 1 (Color cf&echo.&echo %-%&echo ^>^> "%Out%"&Set /p=_☆☆[ メ压缩失败！]☆☆<nul&del /q "%Out%.tmp*" 1>nul 2>nul&echo.&echo %-%&Call :Delay 9 +) else Color 9f&echo.&echo %-%&echo ^>^> "%Out%"&Set /p=_☆☆[ √压缩完成！]☆☆<nul&echo.&echo %-%&Call :Delay 3 +
Exit /b

:RMenu_7zIE :: <DocExt>
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zIE" /f /ve /d "提取文档图片" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zIE" /f /v "Icon" /d "shell32.dll,-171" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zIE\Command" /f /ve /d "\"%Bat%\" ExtrImg \"%%1\"" 1>nul 2>nul
if defined HideRun reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zIE\Command" /f /ve /d "\"%HideRun:&=^&%\" \"%Bat%\" ImgExt \"%%1\"" 1>nul 2>nul
Goto :eof

:RMenu_7zUC :: <RegKey>
Set "CH=&&(Color 9f&echo.&echo %-%&Set /p=_☆☆[ √操作完成！]☆☆<nul&timeout /t 3 2>nul)||(Color cf&echo.&echo %-%&Set /p=_☆☆[ メ操作失败！]☆☆<nul&del /q \"%archive%.tmp*\" 1>nul 2>nul&timeout /t 9 2>nul)"
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC" /f /v "Icon" /t REG_SZ /d "%~dp0%MIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC" /f /v "MUIVerb" /t REG_SZ /d "7-Zip 极限压缩" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC" /f /v "SubCommands" /t REG_SZ /d "" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC" /f /v "Position" /t REG_SZ /d "Middle" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\003" /f /v "MUIVerb" /t REG_SZ /d "=== 注意：不支持带 %% 路径 ===" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\003\Command" /f /ve /t REG_SZ /d "%Nop%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_0" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_0" /f /v "MUIVerb" /t REG_SZ /d "GUI设置：9-极限压缩 ┆ [不含目录]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_0\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom NoDir \"GUI设置：9-极限压缩 不含目录\" \"9\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_0\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ GUI设置：9-极限压缩 不含目录 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((cd /d \"%%%%~i\"&\"%Exc%\" a -t7z -snl -mx=9 -bb%pstr%%mstr% \"%archive%\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_1" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_1" /f /v "MUIVerb" /t REG_SZ /d "GUI设置：9-极限压缩 ┆ [常规压缩]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_1\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom General \"GUI设置：9-极限压缩\" \"9\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_1\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ GUI设置：9-极限压缩 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_0" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_0" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 128M ┆ [较小内存]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_0\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA2 \"多线程 LZMA2 128M\" \"128m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_0\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 128M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -md=128m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_1" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_1" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 128M ┆ [ f=BCJ2 ]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_1\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LBCJ2 \"多线程 LZMA2 128M f=BCJ2\" \"128m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_128_1\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 128M f=BCJ2 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -mf=BCJ2 -md=128m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_0" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_0" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 256M ┆ [中等内存]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_0\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA2 \"多线程 LZMA2 256M\" \"256m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_0\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 256M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -md=256m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_1" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_1" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 256M ┆ [ f=BCJ2 ]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_1\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LBCJ2 \"多线程 LZMA2 256M f=BCJ2\" \"256m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_256_1\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 256M f=BCJ2 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -mf=BCJ2 -md=256m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_0" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_0" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 384M ┆ [高压缩比]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_0\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA2 \"多线程 LZMA2 384M\" \"384m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_0\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 384M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -md=384m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_1" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_1" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 384M ┆ [ f=BCJ2 ]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_1\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LBCJ2 \"多线程 LZMA2 384M f=BCJ2\" \"384m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_384_1\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 384M f=BCJ2 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -mf=BCJ2 -md=384m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_0" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_0" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 512M ┆ [较大内存]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_0\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA2 \"多线程 LZMA2 512M\" \"512m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_0\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 512M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -md=512m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_1" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_1" /f /v "MUIVerb" /t REG_SZ /d "多线程 LZMA2 512M ┆ [ f=BCJ2 ]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_1\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LBCJ2 \"多线程 LZMA2 512M f=BCJ2\" \"512m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_512_1\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 多线程 LZMA2 512M f=BCJ2 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=on -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA2 -mf=BCJ2 -md=512m -mfb=273 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_xxx" /f /v "MUIVerb" /t REG_SZ /d "=== ↑压缩相对快 ↓压缩巨慢 ===" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA2_xxx\Command" /f /ve /t REG_SZ /d "%Nop%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_128" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_128" /f /v "MUIVerb" /t REG_SZ /d "单线程 LZMA_ 128M ┆ [较小内存]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_128\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA \"单线程 LZMA 128M\" \"128m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_128\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 单线程 LZMA 128M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=off -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA:d=128m:fb=273:lc=8 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_256" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_256" /f /v "MUIVerb" /t REG_SZ /d "单线程 LZMA_ 256M ┆ [中等内存]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_256\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA \"单线程 LZMA 256M\" \"256m\" \"%%1\"" 1>nul 2>nul
::reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_256\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 单线程 LZMA 256M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=off -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA:d=256m:fb=273:lc=8 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_384" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_384" /f /v "MUIVerb" /t REG_SZ /d "单线程 LZMA_ 384M ┆ [高压缩比]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_384\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA \"单线程 LZMA 384M\" \"384m\" \"%%1\"" 1>nul 2>nul
::reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_384\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 单线程 LZMA 384M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=off -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA:d=384m:fb=273:lc=8 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_512" /f /v "Icon" /t REG_SZ /d "%~dp0%FIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_512" /f /v "MUIVerb" /t REG_SZ /d "单线程 LZMA_ 512M ┆ [较大内存]" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_512\Command" /f /ve /t REG_SZ /d "\"%Bat%\" UltiCom LZMA \"单线程 LZMA 512M\" \"512m\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\LZMA_512\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%zn% 2>nul)&Color 2f&Title 7-Zip 极限压缩%mm% -^> [ 单线程 LZMA 512M ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exc%\" a -t7z -snl -mx=9 -myx -mmt=off -ms=on -mtr=on -mtm=on -mtc=off -mta=off -m0=LZMA:d=512m:fb=273:lc=8 -bb%pstr%%mstr% \"%archive%\" \"%%%%~i\")%CH%)" 1>nul 2>nul
if %~1. neq *. Goto :eof
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\000" /f /v "Icon" /t REG_SZ /d "%~dp0%MIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\000" /f /v "MUIVerb" /t REG_SZ /d "解压  >>>  ☆ 智能解压到文件夹 ☆" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\000\Command" /f /ve /t REG_SZ /d "\"%Bat%\" SmartDc Judge \"智能解压到文件夹\" \"%%1\"" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\001" /f /v "Icon" /t REG_SZ /d "%~dp0%MIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\001" /f /v "MUIVerb" /t REG_SZ /d "解压  >>>  ☆ 解压到当前文件夹 ☆" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\001\Command" /f /ve /t REG_SZ /d "\"%Bat%\" Extract \"解压到当前文件夹\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\001\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,%dn% 2>nul)&Color 2f&Title 7-Zip 解压缩%mm% -^> [ 解压到当前文件夹 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do ((\"%Exd%\" x \"%%%%~i\" -o\"%%%%~dpi\"%dstr%%pstr%)%CH%)" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\002" /f /v "Icon" /t REG_SZ /d "%~dp0%MIcon%" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\002" /f /v "MUIVerb" /t REG_SZ /d "转换  >>>  ☆ 7z转换自解压程序 ☆" 1>nul 2>nul
reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\002\Command" /f /ve /t REG_SZ /d "\"%Bat%\" MakeSfx \"7z转换自解压程序\" \"%%1\"" 1>nul 2>nul
:: reg add "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\002\Command" /f /ve /t REG_SZ /d "cmd /c @echo off&(%Mode% 82,18 2>nul)&Color 2f&Title 7-Zip 极限压缩 -^> [ 7z转换自解压程序 ] -^> @%%%%time:~0,-3%%%%&for %%%%i in (\"%%1\") do if /i \"%%%%~xi\" == \".7z\" (echo 生成文件: ↓&echo \"%%%%~dpni.exe\"&echo %-%&echo.&(copy /b \"%Sfx%\" + \"%%%%~i\" \"%%%%~dpni.exe\")%CH%)" 1>nul 2>nul
reg delete "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\003" /f 1>nul 2>nul
reg delete "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_0" /f 1>nul 2>nul
reg delete "HKLM\SOFTWARE\Classes\%~1\Shell\7zUC\Shell\GUI_09_1" /f 1>nul 2>nul
Goto :eof

:DRSpac :: 删除尾部空格
if "%PDir:~-1%" == " " (
Set "PDir=%PDir:~0,-1%"&Goto DRSpac)
if "%Name:~-1%" == " " (
Set "Name=%Name:~0,-1%"&Goto DRSpac)
if "%Desk:~-1%" == " " (
Set "Desk=%Desk:~0,-1%"&Goto DRSpac)
if "%PVar:~-1%" == " " (
Set "PVar=%PVar:~0,-1%"&Goto DRSpac)
Goto %Jump%

:Delay :: 延迟操作 <%1=Sec|延迟秒数> [%2=+|显示倒计时]。
if "%~2" == "+" (Set #=2) else Set #=1
if exist %WinDir%\System32\timeout.exe (timeout /t %~1 %#%>nul) else if exist %WinDir%\System32\choice.exe (choice /t %~1 /d y /n >nul) else ping 127.1 -n %~1 >nul
Goto :eof

:EchoX :: 显示彩色文字 (不支持半角字符 \ / : * ? " < >|. % ! ~)。
Setlocal EnableDelayedExpansion
Set echox=EchoX.exe&&!echox! 1>nul 2>nul||(Set echox=&mkdir "%TEMP%\EchoX" 2>nul&&attrib +s +h "%TEMP%\EchoX" 2>nul)
for %%a in (%*) do (
    Set "param=%%~a"&Set "color=!param:~0,2!"&(if not exist %WinDir%\System32\findstr.exe if not defined echox Set "color=xx")
    Set n=0&(if "!param:~2,2!" == "::" Set n=1)&(if "!param:~2,2!" == ".:" Set n=2)
    if !n! gtr 0 (
        if /i "!color!" == "xx" (Set /p="_!param:~4!"<nul) else (Set param=%%~nxa&if defined echox (!echox! -c !color! -n "!param:~4!") else (Pushd "%TEMP%\EchoX" 2>nul&>"!param:~4!",Set /p= <nul&findstr /a:!color! .* "!param:~4!*"&del "!param:~4!"&Popd))
        if !n! == 2 echo.
    ) else if defined param Set /p="_!param!"<nul
)
Endlocal&Goto :eof