我正在使用下面的Sub将参数传递给Powershell。
     Sub testpower()
      Set WshShell = CreateObject("WScript.Shell")
      WshShell.Run ("Powershell.exe -file .\test.ps1 -path ""Shell.txt"" ")
     End Sub但是,在VB中运行时不会生成输出,但如果尝试直接从run命令运行,则会提供所需的result.Please帮助。
test.ps1脚本:
 Param([String]$path)
    Get-AuthenticodeSignature $path | Out-File  "C:\Documents and Settings\acmeuser1\output.txt"发布于 2016-12-10 07:17:45
这个问题基本上在VBscript code to capture stdout, without showing console window中得到了回答--有几种技术被认为是有效的。总而言之,使用WShell.Exec而不是WShell.Run,然后通过WShell.StdOut.ReadLine()或WShell.StdOut.ReadAll()捕获输出。
https://stackoverflow.com/questions/19156178
复制相似问题