0
我假設有一種方法可以使這個子?我假設Do Until Loop是要走的路,我只是不知道如何構建一個。將文本文件中的行放在Shell CMD中。 VB.net
Sub Main()
'Declare Command
Dim sCommand As String
'Declare File where Users are Located
Dim strFile As String = "C:\TestDUsers.txt"
'Running from Admin Comptuer so permissions are fine
'Want to replace the ******** section with each username from text file
sCommand = "pushd \\*********\C$ && whoami.exe >> C:\File.txt"
'Load the File and perform the loop????
Using sr As New StreamReader(File.Open(strFile, FileMode.Open))
End Using
Console.WriteLine()
Console.Clear()
End Sub
基本上無論如何,將插入每個用戶名形式的TXT文件,並運行上述命令。我現在正在解決它的問題,並且很快就會編輯 – sealz 2011-05-19 19:45:09
這很有效。我需要執行Shell(「cmd.exe/c」&ThisCommand)纔不會引發錯誤。可能是我的錯。 看來,當它試圖移動到文件中的下一行時,它說文件已經在使用中。例如,我應該能夠在USER文本文件中列出我的個人計算機兩次,並讓它返回兩次結果。 – sealz 2011-05-19 20:10:13