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


Purushottam RathoreRank #120 · 18.2K reputationPosted Dec 9, 2009, 7:52 PM EST
//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();
}
Hiren SoniRank #694 · 3.5K reputationPosted Dec 9, 2009, 10:43 PM EST
Tobin Tony4 reputationPosted Jul 12, 2014, 2:34 AM EDT
jingeRank #2,527 · 554 reputationPosted Dec 9, 2009, 8:00 PM EST
Lalit MRank #1,186 · 1.5K reputationPosted Dec 9, 2009, 11:07 PM EST
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