从 Autoit 执行 powershell 脚本?
Execute powershell script from Autoit?
如何从 AutoIt 代码执行 powershell 脚本?
我猜它可能是这样的:
Runwait(@ComSpec & " /c powershell.exe c:\Mytest.ps1", "", @SW_HIDE)
或
Runwait(powershell.exe c:\Mytest.ps1", "", @SW_HIDE)
但这两个似乎都不起作用。
Runwait("powershell.exe c:\Mytest.ps1", "", @SW_HIDE)
然后右键单击 au3 文件和 select 'run script(x64)'
我使用的测试 powershell 脚本:
"heelllo" >> h:\somesome.txt
我结束了,这个解决方案似乎有效:
Local $iPID = Run('powershell.exe -executionpolicy bypass -windowstyle hidden -noninteractive -nologo -file C:\MyScript.ps1"', "c:\", @SW_HIDE, $STDOUT_CHILD)
; Wait until the process has closed using the PID returned by Run.
ProcessWaitClose($iPID)
; Read the Stdout stream of the PID returned by Run.
Local $sOutput = StdoutRead($iPID)
如何从 AutoIt 代码执行 powershell 脚本?
我猜它可能是这样的:
Runwait(@ComSpec & " /c powershell.exe c:\Mytest.ps1", "", @SW_HIDE)
或
Runwait(powershell.exe c:\Mytest.ps1", "", @SW_HIDE)
但这两个似乎都不起作用。
Runwait("powershell.exe c:\Mytest.ps1", "", @SW_HIDE)
然后右键单击 au3 文件和 select 'run script(x64)'
我使用的测试 powershell 脚本:
"heelllo" >> h:\somesome.txt
我结束了,这个解决方案似乎有效:
Local $iPID = Run('powershell.exe -executionpolicy bypass -windowstyle hidden -noninteractive -nologo -file C:\MyScript.ps1"', "c:\", @SW_HIDE, $STDOUT_CHILD)
; Wait until the process has closed using the PID returned by Run.
ProcessWaitClose($iPID)
; Read the Stdout stream of the PID returned by Run.
Local $sOutput = StdoutRead($iPID)