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