Click here to Skip to main content
15,918,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a exe on a Windows machine.
I want to execute the exe through .NET hosted on another machine.

The user id used to execute the exe manually cannot be authenticated as it is not in ACtive directory.

Is there any way to execute the exe.
Posted

1 solution

Yes, use the System.Diagnostics.Process class:
C#
System.Diagnostics.Process p = System.Diagnostics.Process.Start("C:\\ProcessName.exe");
            // to close the process, invoke p.Close()
            // to stop the process immediatly, invoke p.Kill()


The method System.Diagnostics.Process.Start returns a System.Diagnostics.Process.

More about the System.Diagnostics.Process class[^]
 
Share this answer
 
v2
Comments
Ashok26 6-Nov-12 11:20am    
What happens when the exe is on another machine and it requires a specific login to run the exe manually?
Thomas Daniels 6-Nov-12 12:42pm    
Then, do this:
string pw = "password";
System.Security.SecureString s = new SecureString();
foreach (char c in pw)
{
s.AppendChar(c);
}
pw = null;
System.Diagnostics.Process.Start("C:\\process.exe", "User", s, Environment.UserDomainName);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900