Reputation: 42
I want to start a program using this code:
private void PBox_Banner_Click(object sender, EventArgs e)
{
string JavaPath = @"C:\Program Files\Java\jre8\bin\javaw.exe";
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = JavaPath;
startInfo.Arguments = @"-Xmx1024-jar "D:\Log4-cg.jar"";
Process.Start(startInfo);
}
The problem is that I have to use a string within the argument string.
I am using Microsoft Visual Studio Express 2012 for Windows Desktop.
Upvotes: 1
Views: 110
Reputation: 348
If David's solution doesn't work, the old-school fallback should:
startInfo.Arguments = "-Xmx1024-jar \"D:\\Log4-cg.jar\"";
Upvotes: 0
Reputation: 3813
Doubling up on the quotes should fix it.
startInfo.Arguments = @"-Xmx1024-jar ""D:\Log4-cg.jar""";
Upvotes: 2