Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

yes, sry thah i didn't explean mysellf clearly(sry happen a lot :( )

I have a application and i call:

pacth to exe/apache.exe -t,

it open a command windows with the text syntax ok, or a error msg if somthing is wrong, instead of showing the command windows i would like to put the information into a textbox.

  • *Experts*
Posted

The ProcessStartInfo class will provide you with an option to get the output from a console app. Then you can pass in the ProcessStartInfo class into the Process.Start method.

Dim pi As New ProcessStartInfo("cmd.exe")
pi.RedirectStandardOutput = True
pi.UseShellExecute = False 'required call to redirect streams
Dim p As Process = p.Start(pi)
p.WaitForExit()
MessageBox.Show(p.StandardOutput.ReadToEnd()) 'show what the application tried to print onto the console

Now this will get all the text that the application would normally print ou to the console and put into the stream instead, thus nothing will print on the console itself.

Posted

ok i pass /k apache -t to cmd.exe,

but it only returns:

Microsoft Windows XP [Version 5.1.2600]

© Copyright 1985-2001 Microsoft Corp.

 

C:\Documents and Settings\Jorge Schrauwen\Desktop\pluginexample\WindowsApplication1\bin>

C:\Documents and Settings\Jorge Schrauwen\Desktop\pluginexample\WindowsApplication1\bin>

instead of systax ok,

and nothing when i start apache.exe instread of cmd and pass the argument "-t"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...