How do I execute command line arguments with parameters in C #?
I am trying to compare two folders using the third party UltraCompare comparison tool. The next line calls the program and opens two files ... but it does nothing but open them, and it also doesn't work as expected for folders.
Process.Start("C:\\Program Files\\IDM Computer Solutions\\UltraCompare\\uc.exe",
textBoxContents1 + " " + textBoxContents2);
I would like to use the following command line call, which opens two folders, compares against them, and saves the results in the output.txt file: uc -d -dmf "c: \ dir1" "c: \ dir2" -o "c: \ output.txt "
Also, I will need to use variables for folders instead of hardcoding paths.
How can I work with this code in C #?
UPDATE 1:
I have modified my code as per your suggestions:
var p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\\Program Files\\IDM Computer Solutions\\UltraCompare\\uc.exe";
p.StartInfo.Arguments = String.Format("-d -dmf \"{0}\" \"{1}\" -o c:\\output2.txt",
textBoxContents1, textBoxContents2);
p.Start();
I am wondering why the third line containing the arguments is still not working ...
UPDATE 2:
My mistake. He is working now! Just doesn't display folders in UltraCompare, but it still writes and saves the result. Thanks guys!
source to share
you can use
yourProcess.StartInfo.Arguments = " .....";
Example
var p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\\Program Files\\IDM Computer Solutions\\UltraCompare\\uc.exe";
p.StartInfo.Arguments = String.Format("-d -dmf {0} {1} -o c:\output.txt",textBoxContents1, textBoxContents2);
p.Start();
source to share