My objective is to issue the following to a command line from within a C# Windows Forms application:
load.exe --ip="192.168.1.88" C:\MyFiles\file1.txt C:\MyFiles\file2.txt
The following is my current attempt and I have observed that it is not performing the desired behavior nor am I getting any build or runtime errors:
string ipAddress = "192.168.1.88"
public static void LoadMyFiles(string ipAddress)
{
Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = @"C:\Program Files (x86)\MyProgram\load.exe";
process1.StartInfo.UseShellExecute = false;
process1.StartInfo.Arguments = "--ip=\"ipAddress\" C:\\MyFiles\\file1.txt\ C:\\MyFiles\\file2.txt\";
process1.StartInfo.RedirectStandardOutput = true;
process1.Start();
}
An alternative attempt I tried for StartInfo.Arguments using String.Concat also failed to execute properly.
processL1.StartInfo.Arguments = String.Concat("--ip=\"", ipAddress, "\"C:\\MyFiles\\file1.txt C:\\MyFiles\\file2.txt");
I have validated the desired behavior occurs if I manually issue the aforementioned line in a cmd window and thus believe this has been narrowed down to a syntax issue.
Answers with regard to any syntax issues I have made are appreciated.