0

I want to run ant.bat file in my C# application, but I am struggling of how to pass arguments there.

I have xmlFile, mode and date which I want to pas as strings for the .bat file to work. What I've tried:

void OpenWithArguments(string f)
    {
        Process.Start("ant.bat", file.xml);
    }


 Process process = new Process();
                    process.StartInfo.FileName = @"C:\aa\ant.bat";
                    process.StartInfo.Arguments = file.xml;
                    process.Start();

but how to pass several arguments for the .bat file?

And by arguments I meant variables that I get from other methods, like: string path = file.xml `string date="2015-05-23" and so on. Can I also pass them the same way?

user122222
  • 2,179
  • 4
  • 35
  • 78
  • It's not the same though – user122222 Jun 20 '18 at 08:04
  • It is the same, as said there [ProcessInfo.Arguments](https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.arguments(v=vs.110).aspx) is just a string, if you want to pass multiple values, you need to add a whitespace between the values. – Esko Jun 20 '18 at 12:34

0 Answers0