起因
在网上找了个Beyond Compare5的授权码,用来使用Beyond Compare5,但是发现经常会出现Beyond Compare5 授权密钥已被吊销的提示,就无法使用了。如下图:
![提示]()
解决方法(windows 系统)
- 找到下图所示文件BCSessions.xml和BCState.xml
 ![文件路径]() 
- 在文件BCSessions.xml中,找到Flags=,删掉掉Flags=后面的所有内容,保存文件。如下图:
 ![BCSessions.xml]() 
 3.在文件BCState.xml中,找到CheckID和LastChecked,将这两行删除即可。如下图:
 ![BCState.xml]() 
重启
重启,问题解决。
自动处理方法
我发现我这边经常出现这个问题,如果每次都手动去修改的话,比较麻烦。所以偷懒写了一个自动化的脚本。每当失效的时候,直接执行这个脚本就行了。
| 12
 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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 
 | import osimport re
 import shutil
 
 
 folder_path = r"C:\Users\xxxx\AppData\Roaming\Scooter Software\Beyond Compare 5"
 sessions_path = os.path.join(folder_path, "BCSessions.xml")
 state_path = os.path.join(folder_path, "BCState.xml")
 
 
 def backup_file(file_path):
 if os.path.exists(file_path):
 backup_path = file_path + ".bak"
 shutil.copy(file_path, backup_path)
 print(f"已备份文件:{file_path} -> {backup_path}")
 
 
 def clean_bcsessions(path):
 if not os.path.exists(path):
 print("❌ 未找到 BCSessions.xml 文件")
 return
 
 backup_file(path)
 
 with open(path, 'r', encoding='utf-8') as f:
 content = f.read()
 
 modified = re.sub(r'(BCSessions\s+Flags=)"[^"]*"', r'\1""', content)
 
 if content != modified:
 with open(path, 'w', encoding='utf-8') as f:
 f.write(modified)
 print("✅ BCSessions.xml 修改完成:Flags 属性已清空。")
 else:
 print("ℹ️ BCSessions.xml 中未发现需要修改的 Flags。")
 
 
 def clean_bcstate(path):
 if not os.path.exists(path):
 print("❌ 未找到 BCState.xml 文件")
 return
 
 backup_file(path)
 
 with open(path, 'r', encoding='utf-8') as f:
 lines = f.readlines()
 
 filtered_lines = [line for line in lines if not (
 'CheckID Value=' in line or 'LastChecked Value=' in line)]
 
 if len(lines) != len(filtered_lines):
 with open(path, 'w', encoding='utf-8') as f:
 f.writelines(filtered_lines)
 print("✅ BCState.xml 修改完成:已删除相关行。")
 else:
 print("ℹ️ BCState.xml 中未发现 CheckID 或 LastChecked 行。")
 
 
 if __name__ == "__main__":
 clean_bcsessions(sessions_path)
 clean_bcstate(state_path)
 
 | 
如果觉得手动执行脚本还比较麻烦,那可以弄成一个bat文件,将bat文件放在桌面,双击bat文件即可。
| 1
 | python3 clean_beyond_compare.py
 |