Executing Third Party Program from .NET
Hi,
I have been using System.Diagnostics.ProcessStartInfo class to execute cmd.exe which run non-Window commands such as pscp.exe to transfer file. My problem is that I need to pass value to the pscp.exe command when it prompt for input.
Code:
'**start the process
Dim myProcess As System.Diagnostics.Process = System.Diagnostics.Process.Start(myProcessStartInf o)
'**For reading output
Dim myOutput As System.IO.StreamReader = myProcess.StandardOutput
'**Instantiate standard input and writer
Dim myInput As System.IO.StreamWriter = myProcess.StandardInput
Dim inputError As System.IO.StreamReader = myProcess.StandardError
myInput.Flush()
'***Execute pscp.exe to list file
myInput.WriteLine("pscp -ls -pw password user@server:c:\")
'**Expecting a prompt and I need to answer Y here...does not work..just hang because it does not return to command prompt.
myInput.WriteLine("y")
'**exit cmd
myInput.WriteLine("exit")
Any idea or better process that I could/should use?
Thanks!
Peter
__________________
Peter
|