executing a batch file from code

S

Sinex

Hi,
I am triggering a batch file from my C# code. There are no echo commands
in the batch file...yet the console window/command prompt window pops up
every time the batch file is triggerred. Is there a way to stop the window
from appearing and just running all the batch commands in the backgroung?

....Sinex
 
C

CSharper

Sinex,

This should do the trick:

Process myProcess = new Process();
myProcess.StartInfo.FileName = @"c:\mybatch.bat";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcess.Start();
 
C

CSharper

Sinex,

This should do the trick:

Process myProcess = new Process();
myProcess.StartInfo.FileName = @"c:\mybatch.bat";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcess.Start();
 

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