Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 C# 清除 Windows 中的所有事件日志?
using System.Diagnostics; using(var eventLog = new EventLog("Security", System.Environment.MachineName); eventLog.Clear();
删除安全事件日志。
全部删除:
foreach (var eventLog in EventLog.GetEventLogs()) { eventLog.Clear(); eventLog.Dispose(); }