level 10
xkena77
楼主
这是一段用记事本打开查看log文件的代码。因为担心log文件被人改写,我是先复制,然后打开复制文件,最后删除复制文件。分步执行时,是能够正常打开文件的,但正常运行,就说找不到文件。我在文件复制后面停留5秒钟也没用。
System.IO.File.Copy(Application.StartupPath & "\HVTemp.log", Application.StartupPath & "\HVTemp1.log", True)
‘Threading.Thread.Sleep(5000)
System.Diagnostics.Process.Start(Application.StartupPath & "\HVTemp1.log")
System.IO.File.Delete(Application.StartupPath & "\HVTemp1.log")
2015年01月13日 08点01分
1
System.IO.File.Copy(Application.StartupPath & "\HVTemp.log", Application.StartupPath & "\HVTemp1.log", True)
‘Threading.Thread.Sleep(5000)
System.Diagnostics.Process.Start(Application.StartupPath & "\HVTemp1.log")
System.IO.File.Delete(Application.StartupPath & "\HVTemp1.log")