Last active
February 1, 2017 14:02
-
-
Save SteGriff/87fe60165ecdf40149a7ad0e5676cdc0 to your computer and use it in GitHub Desktop.
A tiny VB module to start a process and return its stdout text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Public Module ProcessReader | |
| Public Function StartProcessAndGetOutput(filename As String, Optional args As String = "") As String | |
| Dim startInfo As New ProcessStartInfo() With { _ | |
| .CreateNoWindow = True, _ | |
| .RedirectStandardOutput = True, _ | |
| .RedirectStandardInput = True, _ | |
| .UseShellExecute = False, _ | |
| .Arguments = args, _ | |
| .FileName = filename _ | |
| } | |
| Dim p As New Process() | |
| p.StartInfo = startInfo | |
| p.Start() | |
| p.WaitForExit() | |
| Return p.StandardOutput.ReadToEnd() | |
| End Function | |
| End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment