Jump to content

How to run process with arguments

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
051r151

051r151

    Newbie

  • Members
  • Pip
  • 1 posts
When I'm running program from command line I enter:
program.exe -f batch.bat
I want to do equivalent call from my program. I tried this code:

Process Proc = new Process();
Proc.StartInfo.FileName = "program.exe";
Proc.StartInfo.Arguments = "-f batch.bat";
Proc.Start();

but this code only runs program "program.exe" without passing him the "-f batch.bat" argument. So can someone please tell me how to pass the "-f batch.bat" argument?

Tnx

#2
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
This is the way I've done it in the past (particularly when trying to execute Windows commands):

System.Diagnostics.Process.Start("c:/program.exe", "-f batch.bat");