问题
I'm Using Process.Start from my website to open a windows form application I made in c#.
I want send to the application my username.
So how can I do that?
回答1:
You can use this:
string username = "MyUsername";
Process.Start(Path.Combine("MyExe.exe" + " \"" + username + "\"");
回答2:
You can do this by assigning arguments in start info, e.g.:
var process = new Process
{
StartInfo =
{
FileName = processName,
Arguments = "-username=Alice"
}
};
process.Start();
If your process fails to start you might want to check permissions, as far as I am aware code running on IIS is not allowed to do that.
回答3:
Process.Start() has several overloads, one of them is for specifying the command-line arguments along with the path to the executable.
For example:
Process.Start("app.exe", "parameter(s)");
来源:https://stackoverflow.com/questions/5766574/start-a-process-with-parameters