Beyond Compare是个优秀的工具,我们经常用于对比文件和文件夹,右键点点就可以调用对比,着实很方便.在3.2版本之前,我们可以从设置中将bc关联到文件夹和文件右键,但之后的版本已经找不到此设置选项,我们只能通过其他方法将其添加到右键菜单.

没有此选项每次要先打开bc,然后再选择要比较的文件或文件夹,造成一定的麻烦,也不怎么习惯.

我们可以通过手动添加注册表的方式来解决.

为方便大家,线提供组织好的批处理一份,只需将批处理保存运行即可.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@ECHO OFF
REM 将当前路径设为变量
SET BC3PATH=%~DP0
REM 创建用户配置文件,关闭初次启动程序时的设置向导
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="False"/^>
ECHO ^<FormPosStr Value="110;111;980;737"/^>
ECHO ^</TBcState^>
ECHO ^</BCState^>
) >>"%USERPROFILE%\Application Data\Scooter Software\Beyond Compare 3\BCState.xml"
REM 注册右键
REG ADD "HKCR\shellex\ContextMenuHandlers\Cirrus\ShellEx" /ve /t REG_SZ /d "{57FA2D12-D22D-490A-805A-5CB48E84F12A}" /f
REG ADD "HKCR\CLSID\{57FA2D12-D22D-490A-805A-5CB48E84F12A}" /ve /t REG_SZ /d "CirrusShellEx" /f
REG ADD "HKCR\CLSID\{57FA2D12-D22D-490A-805A-5CB48E84F12A}\InProcServer32" /ve /t REG_SZ /d "%BC3PATH%BCShellEx.dll" /f
REG ADD "HKCR\CLSID\{57FA2D12-D22D-490A-805A-5CB48E84F12A}\InProcServer32" /v "ThreadingModel" /t REG_SZ /d "Apartment" /f
REG ADD "HKCR\Directory\shellex\ContextMenuHandlers\Cirrus\ShellEx" /ve /t REG_SZ /d "{57FA2D12-D22D-490A-805A-5CB48E84F12A}" /f
REG ADD "HKCR\Folder\shellex\ContextMenuHandlers\Cirrus\ShellEx" /ve /t REG_SZ /d "{57FA2D12-D22D-490A-805A-5CB48E84F12A}" /f
REG ADD "HKCR\lnkfile\shellex\ContextMenuHandlers\Cirrus\ShellEx" /ve /t REG_SZ /d "{57FA2D12-D22D-490A-805A-5CB48E84F12A}" /f
REM 程序基本设置
REG ADD "HKCU\Software\Scooter Software\Beyond Compare 3" /v "SupportsMerge" /t REG_DWORD /d 0x1 /f
REG ADD "HKCU\Software\Scooter Software\Beyond Compare 3\BcShellEx" /v "Viewers" /t REG_SZ /d "Text Compare;Data Compare;Hex Compare;MP3 Compare;Picture Compare;Version Compare" /f
REG ADD "HKCU\Software\Scooter Software\Beyond Compare 3\BcShellEx" /v "ArchiveMasks" /t REG_SZ /d "*.7z;*.7z.001;*.bcpkg;*.bcs;*.bcss;*.cab;*.chm;*.ear;*.gz;*.jar;*.rar;*.tar;*.tar.gz;*.tgz;*.war;*.zip;" /f
REM 注册右键
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" /v "{57FA2D12-D22D-490A-805A-5CB48E84F12A}" /t REG_SZ /d "Beyond Compare 3 Shell Extension" /f
GOTO :EOF

如果需要取消右键,就相应的执行下面的批处理.
1
2
3
4
5
6
7
reg delete "HKLM\Software\Scooter Software" /f
reg delete "HKCU\Software\Scooter Software" /f
reg delete "HKCR\.bcpkg" /f
reg delete "HKCR\BeyondCompare.SettingsPackage" /f
reg delete "HKCR\.bcss" /ve /t REG_SZ /d "BeyondCompare.Snapshot" /f
reg delete "HKCR\BeyondCompare.Snapshot" /f
reg delete "HKLM\System\CurrentControlSet\Services\EventLog\Application\Beyond Compare 3" /f