Run the process with parameters

I am using Process.Start from my site to open a Windows form application that I made in C #.

I want to send my username to the application.

So how can I do this?

+6
source share
3 answers

You can use this:

string username = "MyUsername"; Process.Start(Path.Combine("MyExe.exe" + " \"" + username + "\""); 
+1
source

You can do this by assigning arguments to the startup information, for example:

 var process = new Process { StartInfo = { FileName = processName, Arguments = "-username=Alice" } }; process.Start(); 

If your process does not start, you can check the permissions to my knowledge that code running in IIS is not allowed.

+6
source

Process.Start() has several overloads, one of which is used to specify command line arguments and the path to the executable file.

For instance:

 Process.Start("app.exe", "parameter(s)"); 
+5
source

Source: https://habr.com/ru/post/886550/


All Articles