I am trying to get a project to pass a string as an argument to another project using Process
If I have a string:
string argString = "Test Argument"
and I want to pass it as an argument to a second project that simply prints out the arguments that are passed to it, how do I pass that string as a single argument? Meaning if I pass argString
to my second project, I want args[0]
to be: "Test Argument"
instead of it breaking the string into two separate arguments separated by the space in the string.
To summarize, I have project 1 that passes a string as an argument to project 2. Inside Project 1 would be:
string argString = "Test Argument";
Process testProcess = new Process();
testProcess.StartInfo.Arguments = argString;
testProcess.StartInfo.FileName = @"LocationOfProject.exe";
testProcess.Start();
And inside Project 2's main method would be:
Console.WriteLine(args[0]);
Currently this would result in project 2 printing "Test"
instead of what I want, "Test Argument"
. Any ides?