VBAfind安装date和Biosdate远程机器

我想获得一些VBA代码工作返回一个计算机Ping结果,安装date和BIOS版本(获取date)。

For i = 1 To lRow Debug.Print i addr1 = ActiveSheet.Cells(i, 1).Value 'this contains my IP/Computer Name cmdPing = "C:\Windows\System32\PING.EXE " & addr1 Set shPing = CreateObject("Wscript.shell") Set runPing = shPing.exec(cmdPing) strPing = runPing.stdout.readall ActiveSheet.Cells(i, 2).Value = strPing Set runPing = Nothing Set shPing = Nothing cmdInstall = "systeminfo /s " & addr1 & " | findstr /C:""Install Date""" Set shInstall = CreateObject("Wscript.shell") Set runInstall = shInstall.exec(cmdInstall) strInstall = runInstall.stdout.readall ActiveSheet.Cells(i, 3).Value = strInstall Set runInstall = Nothing Set shInstall = Nothing cmdBios = "systeminfo /s " & addr1 & " | findstr /C:""BIOS Version""" Set shBios = CreateObject("Wscript.shell") Set runBios = shBios.exec(cmdBios) strBios = runBios.stdout.readall ActiveSheet.Cells(i, 4).Value = strBios Set runBios = Nothing Set shBios = Nothing Next i 

平安工作正常,但systeminfo短暂闪烁,消失。 我可以只运行"systeminfo /s " & addr1 ,但显然会带来很多不必要的信息。 我有一种感觉,就是通过"性格”,试过/C:" & Chr(34) & "也无济于事。

 cmdInstall = "%comspec% /c systeminfo /s " & addr1 & " | findstr /C:""Install Date""" 

 cmdBios = "%comspec% /c systeminfo /s " & addr1 & " " & Chr(124) & " findstr /C:""BIOS Version"""