Reputation: 2379
Just wondering if there is another way to handle this as the arguments are getting split when passing in like this:
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(fileName);
psi.Arguments = @"c:\dir1\dir2\dir3\file1.txt";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = psi;
p.Start();
Then, in the new application when we access Environment.GetCommandLinesARgs() We are getting an array that looks like this:
string[] arr = {"filename","c:\dir1","dir2","dir3", "file1.txt"}
Upvotes: 0
Views: 1199
Reputation: 27499
The problem is that you aren't passing the arguments in correctly.
You need to include quotes around the path, like this:
psi.Arguments = @"""c:\dir1\dir2\dir3\file1.txt""";
Upvotes: 2