0
我很好奇。如果我正在使用streamreader和streamwriter的组合,是否有一种方法可以让我只有在文件X被修改后才能写入流?使用StreamReader来确定文件是否已更改
此代码可能无法以最佳方式构建。它附在帮助我解答我的问题。
sCommand = "whoami.exe >> C:\Desktop\Test.txt"
Using swrr As New StreamWriter(File.Open(ErrorLog, FileMode.OpenOrCreate))
For Each strUserName As String In strLines
Shell("cmd.exe /c" & sCommand, AppWinStyle.Hide, True,)
'command Cannot Execute, List Why and Move onto Next Command
Using sr As New StreamReader(File.Open(Test.txt, FileMode.OpenOrCreate))
If '''??File has been modifed??''''' Then swrr.WriteLine("PASS") Else swrr.WriteLine("FAIL")
End Using
Next
End Using