首页 > 代码库 > Beyond Compare3 添加到右键菜单

Beyond Compare3 添加到右键菜单

Beyond Compare 是个优秀的工具,我们经常用于对比文件和文件夹,右键点点就可以调用对比,着实很方便.但从3.2版本之前,我们可以从设置中将bc关联到文件夹和文件右键,但之后的版本已经找不到此设置选项.
没有此选项每次要先打开bc,然后再选择要比较的文件或文件夹,造成一定的麻烦,也不怎么习惯.
我们可以通过手动添加注册表的方式来解决. 为方便大家,线提供组织好的批处理一份,只需将批处理保存运行即可.

重要说明:
1:首先确保bc目录下有BCShellEx.dll,或者BCShellEx64.dll,这里两个文件用于32位机器和64位机器的邮件功能,如果没有这两个文件可以在网上下载。
2:本批处理要放在BC3的目录下,然后运行此bat文件
3:运行完成后,需要再次打开BCompare.exe这个软件,点击:工具-->选项-->启动,就可以看到“在资源管理器上.....”的复选框,然后勾选上即可
4:这时在文件上点击右键,就有菜单键了。

BC3添加右键菜单.bat

@ECHO OFFrem 请将此脚本放在BC的目录执行,例如 F:\Software\Beyond CompareREM 将当前路径设为变量SET BC3PATH=%~DP0REM 创建用户配置文件,关闭初次启动程序时的设置向导if exist "%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3" RD /q /s "%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3"IF NOT EXIST "%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3" MD "%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3"COPY /Y NUL "%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3\BCState.xml"(ECHO ^<?xml version="1.0" encoding="UTF-8"?^>ECHO ^<!-- Produced by Beyond Compare 3 from Scooter Software --^>ECHO ^<BCState^>ECHO ^<TBcState^>ECHO ^<FirstStartup Value="http://www.mamicode.com/False"/^>ECHO ^<FormPosStr Value="http://www.mamicode.com/110;111;980;737"/^>ECHO ^</TBcState^>ECHO ^</BCState^>) >> "%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3\BCState.xml"REM 注册右键reg add "HKLM\Software\Scooter Software\Beyond Compare 3" /v "ExePath" /t REG_SZ /d "%cd%\BCompare.exe" /frem reg add "HKLM\Software\Scooter Software\Beyond Compare 3" /v "Version" /t REG_SZ /d "3.1.7.10865" /freg add "HKCU\Software\Scooter Software\Beyond Compare 3" /v "ExePath" /t REG_SZ /d "%cd%\BCompare.exe" /frem reg add "HKCU\Software\Scooter Software\Beyond Compare 3" /v "Version" /t REG_SZ /d "3.1.7.10865" /freg add "HKCR\.bcpkg" /ve /t REG_SZ /d "BeyondCompare.SettingsPackage" /freg add "HKCR\BeyondCompare.SettingsPackage" /ve /t REG_SZ /d "Beyond Compare Settings Package" /freg add "HKCR\BeyondCompare.SettingsPackage\DefaultIcon" /ve /t REG_SZ /d "%cd%\BCompare.exe,0" /freg add "HKCR\BeyondCompare.SettingsPackage\shell\open\command" /ve /t REG_SZ /d "\"%cd%\BCompare.exe\" \"%%1\"" /freg add "HKCR\.bcss" /ve /t REG_SZ /d "BeyondCompare.Snapshot" /freg add "HKCR\BeyondCompare.Snapshot" /ve /t REG_SZ /d "Beyond Compare Snapshot" /freg add "HKCR\BeyondCompare.Snapshot\DefaultIcon" /ve /t REG_SZ /d "%cd%\BCompare.exe,0" /freg add "HKCR\BeyondCompare.Snapshot\shell\open\command" /ve /t REG_SZ /d "\"%cd%\BCompare.exe\" \"%%1\"" /freg add "HKLM\System\CurrentControlSet\Services\EventLog\Application\Beyond Compare 3" /v "EventMessageFile" /t REG_SZ /d "%cd%\BCompare.exe" /freg add "HKLM\System\CurrentControlSet\Services\EventLog\Application\Beyond Compare 3" /v "TypesSupported" /t REG_DWORD /d 7 /f

既然是绿色版本,就在给个取消注册的代码,其实就是对前面注册表的删除,请看下面的卸载的bat代码:
BC3取消右键菜单.bat

reg delete "HKLM\Software\Scooter Software" /freg delete "HKCU\Software\Scooter Software" /freg delete "HKCR\.bcpkg" /freg delete "HKCR\BeyondCompare.SettingsPackage" /freg delete "HKCR\.bcss" /ve /t REG_SZ /d "BeyondCompare.Snapshot" /freg delete "HKCR\BeyondCompare.Snapshot" /freg delete "HKLM\System\CurrentControlSet\Services\EventLog\Application\Beyond Compare 3" /f

参考出处:http://blog.chinaunix.net/uid-24118190-id-3900445.html