Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StandardIn has not been redirected.

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
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]
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
...
...
...
 
Turns out I was creating a bad loop when I wrote.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top