|
- @ECHO OFF
- rem 自动请求以管理员权限运行
- echo CreateObject^("Shell.Application"^).ShellExecute "%~f0", "", "", "runas", 1 > "%temp%\getadmin.vbs"
- reg query HKU\S-1-5-20>nul 2>nul||cscript //b "%temp%\getadmin.vbs"&&del "%temp%\getadmin.vbs" /f /q>nul 2>nul&&exit /b
- pushd %~dp0
- ECHO 1. 增加带子菜单的右键菜单77zz并关联.7z
- ECHO 2. 删除带子菜单的右键菜单77zz并取消关联.7z
- echo.
- SET /P SEL=
- echo.
- IF %SEL%==2 CALL :DEL
- IF %SEL%==1 CALL :ADD
- echo.
- echo.
- PAUSE
- EXIT
- :ADD
- REM 设置关联
- if not exist %~dps07zfm.exe echo 未发现7-Zip主程序,请将我放在7-Zip根目录下。&pause>nul&exit
- REG ADD HKCR\.7z /VE /D "7-Zip.7z" /F
- REG ADD HKCR\7-Zip.7z /VE /D "7z Archive" /F
- REG ADD HKCR\7-Zip.7z\DefaultIcon /VE /T REG_SZ /D "%~dps07z.dll,0" /F
- REG ADD HKCR\7-Zip.7z\shell\open\command /VE /T REG_EXPAND_SZ /D ""%~dp07zFM.exe" "%%1"" /F
- REM ------------------------增加带子菜单的右键菜单------------------------>>
- REM 定义子菜单具体内容
- REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\77zzmax /VE /D "极限压缩为7z" /F
- REM 注意:你提供的极限压缩命令有问题,请自己解决,我懒的研究了。
- REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\77zzmax\command /VE /D ""%~dp07zg.exe" a -r -t7z -mx9 "%%1" .7z "%%1"" /F
- REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OpenWith77zz /VE /D "用7Z打开" /F
- REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OpenWith77zz\command /VE /D ""%~dp07zFM.exe" "%%1"" /F
- REM 定义子菜单要项目名称列表
- REG ADD HKCR\*\shell\77zz /V "SubCommands" /D "77zzmax" /F
- REG ADD HKCR\7-Zip.7z\shell\77zz /V "SubCommands" /D "77zzmax;OpenWith77zz" /F
- REM 定义名称,默认77zz可以省略此键值
- REG ADD HKCR\*\shell\77zz /V "MUIVerb" /D "77zz" /F
- REM 定义图标,不要可以省略此键值
- REG ADD HKCR\*\shell\77zz /V "Icon" /D "%~dps07z.dll,0" /F
- REG ADD HKCR\7-Zip.7z\shell\77zz /V "Icon" /D "%~dps07z.dll,0" /F
- REM 增加文件夹右键菜单和显示的子菜单
- REG ADD HKCR\Directory\shell\7zz /V "SubCommands" /D "77zzmax" /F
- REM 定义图标,不要可以省略此键值
- REG ADD HKCR\Directory\shell\7zz /V "Icon" /D "%~dps07z.dll,0" /F
- REM <<------------------------增加带子菜单的右键菜单------------------------
- GOTO :EOF
- :DEL
- REM 清理关联
- REG DELETE HKCU\Software\7-Zip /F 2>NUL
- REG DELETE HKCR\.7z /F 2>NUL
- REG DELETE HKCR\7-Zip.7z /F 2>NUL
- REM 清理右键菜单
- REG DELETE HKCR\*\shell\77zz /F 2>NUL
- REG DELETE HKCR\Directory\shell\7zz /F 2>NUL
- REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\77zzmax /F 2>NUL
- REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\OpenWith77zz /F 2>NUL
- GOTO :EOF
复制代码 |
|