Passing an input to a process

M

mhmtzdmr

Hi,

I want to call a program and redirect the standart out to richtextbox
control.


I am using the procedure below.

-------------------------------------------------------------------------------------------------------------------------
Public Sub RunApp(ByVal myprocess As String, ByVal param As String,
ByVal workingDir As String)
Dim p As Process = New Process()
Dim psi As New ProcessStartInfo()
psi.FileName = myprocess
psi.WorkingDirectory = workingDir
psi.Arguments = param
psi.UseShellExecute = False
psi.CreateNoWindow = True
psi.RedirectStandardOutput = True
psi.RedirectStandardError = True
p.StartInfo = psi
p.Start()

myRichTextBox.text=p.StandardOutput.ReadToEnd()

End Sub
-------------------------------------------------------------------------------------------------------------------------




I call this procedure like this:
RunApp("C:\Program Files\DA Manager CLI\auhgmap", "-unit my_unit
-refer", "")


This calls "auhgmap" program and redirects its output to RichTextBox
control.

Everything works fine till here. But, I experience some problems when I
call another similar program which accepts a password from me. My main
program (vb.net) hangs. For example when I call my program from cmd.exe
I see it is expecting a password and it does not generate any output
unless I enter a password input to it.



For example,

C:\Program Files\DA Manager CLI>aufibre1 -unit Thunder_9500V -refer
Password:
..
..
.. // ---->> After entering the password I can get the
output
..
..
C:\Program Files\DA Manager CLI>




Question: How can I pass a parameter (the password) to another program
using Process class?


Thanks and regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top