我嘗試複製事件日誌「應用程序」到另一個文件夾在我的電腦上,但總是得到錯誤試圖讓一個事件日誌文件複製到另一個文件夾備份目的
」 ....找不到路徑 「一部分C:\ WINDOWS \ SYSTEM32 \ winevt \日誌\ Application.evtx ......」
我使用的代碼:
public void collectEventLogsFromSystem(string RequestedlogName,string newFolderPath)
{
string combinedLogToFind = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Eventlog\\" + RequestedlogName;
string LogEventsPath = (string)Registry.GetValue(combinedLogToFind, "File", null);
if (LogEventsPath != null)
{
System.IO.File.Copy(LogEventsPath, newFolderPath +"\\"+ RequestedlogName, true);
}
}//collectEventLogsFromSystem method
即使我使用明確的文件夾路徑它不會工作:
System.IO.File.Copy(@"C:\Windows\System32\winevt\Logs\Application.evtx", "c:\\ttt\\Application.evtx", true);
任何想法?
非常感謝!這解決了我的問題......我以爲我要瘋了......謝謝!! – MottiNissim