Question : C# .net - issue parsing arguments between to program

Hi,
I have two c# .net applications (both winforms).

The first program calls the second with an argument. The argument Im passing is a directory string.

If there is a space in the directory string the string gets cut off.

Program 1 calls the second program like this....
1:
System.Diagnostics.Process.Start(@"\\server\program2.exe", @"\\server\folder name2\" + txtTarget.Text);


Program 2 receives the argument like this
1:
String strSource = args[1] + @"\document.xml";


Program 1 seems to be parsing the correct string. I think program 2 is not reading the full argument properly.

If the argument is "\\server\folder name2\subfolder" program 2 on gets "\\server\folder"

Any ideas

Sm17ch

Answer : C# .net - issue parsing arguments between to program

I think you have to use double quotes. I made a slight error in my previous post. This should be accurate:
1:
System.Diagnostics.Process.Start(@"\\server\program2.exe", @"""\\server\folder name2\" + txtTarget.Text + @"""");
Random Solutions  
 
programming4us programming4us