How to run .EXE on button click in C#
How to run .EXE on button click in C#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Purushottam RathorePosted Dec 10, 2009, 12:52 AM
//This namespace provides access to local and remote processes and enables you to start and stop local system processes.
protected void Button1_Click(object sender, EventArgs e)
{
// string str = @"C:\windows\system32\notepad.exe";
// string str = @"C:\windows\system32\winamp.exe";
string str = @"C:\Documents and Settings\Puru\Desktop\NewsLetter\SendNewsletter.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
Tobin TonyPosted Jul 12, 2014, 6:34 AM
prasanta pradhanPosted Dec 12, 2009, 8:26 AM
Server side
How to run .EXE on button click in C#
Use the Name space
using System.Diagnostics;
private void MyButtonClick(object sender, EventArgs e)
{
Process[] procs = Process.GetProcessesByName("winword");
TheProcessYouNamed = Process.Start("winword.exe");
}
Or Client Side
var shell = new ActiveXObject("Shell.Appli
var command = "C:\\windows\\ winword.exe"
shell.ShellExecute(command
Thank's
Prasanta Kumar Pradhan
Lalit MPosted Dec 10, 2009, 4:07 AM
MyButton.Click += new EventHandler(MyButtonClick);
This points to the MyButtonClick function.
Now you need to add:
using System.Diagnostics;
Then create a process:
Process TheProcessYouNamed;
private void MyButtonClick(object sender, EventArgs e)
{
TheProcessYouNamed = Process.Start("EXEToRun.exe");
TheProcessYouNamed.CloseMainWindow();
}
OR
This code uses JS to run an application on a client side (windows).
If you write that out into the HTML, it will open up notepad when the user views the page