情况一 没有“cmd /c ”开头去执行dos命令(dos命令带有管道操作符和其他命令),单独一个dos命令有没有cmd开头貌似都没啥异常

Set oExec=WshShell.exec(" netstat -ano|findstr 843")

Set oStdOut = oExec.StdOut
strLine = oStdOut.ReadLine

此时strline 为空。也就是oStOut里面没有接受到东西。

情况二 加上“cmd /c ”

Set oExec=WshShell.exec("cmd /c netstat -ano|findstr 843")

Set oStdOut = oExec.StdOut
strLine = oStdOut.ReadLine

此时strLine 就有内容了。

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2022-02-23
  • 2022-12-23
  • 2021-10-31
  • 2021-12-18
  • 2021-12-04
  • 2022-12-23
  • 2022-02-07
相关资源
相似解决方案