executing a batch file from code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sinex

    executing a batch file from code

    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


  • CSharper

    #2
    Re: executing a batch file from code

    Sinex,

    This should do the trick:

    Process myProcess = new Process();
    myProcess.Start Info.FileName = @"c:\mybatch.ba t";
    myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
    myProcess.Start ();

    Sinex wrote:[color=blue]
    > 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
    >
    >[/color]

    Comment

    • CSharper

      #3
      Re: executing a batch file from code

      Sinex,

      This should do the trick:

      Process myProcess = new Process();
      myProcess.Start Info.FileName = @"c:\mybatch.ba t";
      myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
      myProcess.Start ();

      Sinex wrote:[color=blue]
      > 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
      >
      >[/color]

      Comment

      Working...