Skip to content

Instantly share code, notes, and snippets.

@exorcistas
Created April 23, 2022 19:44
Show Gist options
  • Save exorcistas/675138bcf3b5a431d866f2bf560a6178 to your computer and use it in GitHub Desktop.
Save exorcistas/675138bcf3b5a431d866f2bf560a6178 to your computer and use it in GitHub Desktop.
AutoIt function for simple command line I/O
Func RunCommand($_sCommand)
ConsoleWrite(@CRLF & ">> RunCommand: " & $_sCommand & @CRLF)
Local $processId = Run(@ComSpec & " /c " & $_sCommand, "", @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($processId)
Local $_stdout = StdoutRead($processId)
ConsoleWrite(">> STDOUT: " & $_stdout & @CRLF)
Return $_stdout
EndFunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment