Alright, I seem to be chasing my tail here. I am sure I have this right, but aparently I am missing something.
I receive the error when I close the standardinput stream. What didn't I do?
[tt]
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: StandardIn has not been redirected.
at System.Diagnostics.Process.get_StandardInput()
at pimReceive.cVendor.RunAndDump(String cmd, String cwd, Stream& stdin) in ... :line 377
[/tt]
I receive the error when I close the standardinput stream. What didn't I do?
[tt]
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: StandardIn has not been redirected.
at System.Diagnostics.Process.get_StandardInput()
at pimReceive.cVendor.RunAndDump(String cmd, String cwd, Stream& stdin) in ... :line 377
[/tt]
Code:
dim sInfo as ProcessStartInfo
dim proc as Process
set sInfo = new ProcessStartInfo
set proc = new Process
'create initialization for process
With sInfo
.WindowStyle = ProcessWindowStyle.Hidden
.CreateNoWindow = True
.UseShellExecute = false
.RedirectStandardOutput = true
.RedirectStandardInput = true
.WorkingDirectory = "c:\scripts"
.Filename = "cscripts.exe"
.Arguments = "//B script.wsf"
end with
With proc
'Open File and start parser
.Start(sInfo)
'write input to parser and close file
with .StandardInput
.Write("Hello")
.Write(vbnewline & vbnewline & vbnewline)
.Close()
end with
'capture output until process finished
...
...
end proc
'clean up
...
...
...