supress command prompt

G

Guest

Hi ,

I want to run a batch file from the c# code. Every time i run the batch file
command prompt is displayed. I do not want to show this command prompt.

Is there any way to suppress the command prompt.


Regards,
Y iguchi
 
M

Michael A. Covington

I'm not 100% sure what you're looking for, but try including the line

@prompt $g

as the first line of the .bat file. That will change the command prompt to
just ">".
 
T

Tom Spink

YIguchi said:
Hi ,

I want to run a batch file from the c# code. Every time i run the batch
file command prompt is displayed. I do not want to show this command
prompt.

Is there any way to suppress the command prompt.


Regards,
Y iguchi

Hi,

Yes, try this:

///
using System.Diagnostics;

ProcessStartInfo pi = new ProcessStartInfo("batch.bat");
pi.UseShellExecute = false;

Process proc = new Process();
proc.StartInfo = pi;
proc.Start();
///
 
P

PS

YIguchi said:
Hi ,

I want to run a batch file from the c# code. Every time i run the batch
file
command prompt is displayed. I do not want to show this command prompt.

Is there any way to suppress the command prompt.

Do you want to hide the "DOS window" completely? You do this using
ProcessWindowStyle.Hidden for the value of the WindowsStyle property in
ProcessStartInfo.

PS
 
P

Pete Kane

YIguchi said:
Hi ,

I want to run a batch file from the c# code. Every time i run the batch file
command prompt is displayed. I do not want to show this command prompt.

Is there any way to suppress the command prompt.


Regards,
Y iguchi

The previous replies were almost correct, to completely hide the Dos window you need a combination of both the previous replies

ProcessStartInfo pi = new ProcessStartInfo("batch.bat");
pi.WindowStyle = ProcessWindowStyle.Hidden;
Process proc = new Process();
proc.StartInfo = pi;
proc.Start();

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