ProcessStartInfo psi = new ProcessStartInfo("notepad.exe");
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(MyExited);
p.StartInfo = psi;
p.Start();
..... do stuff ...
p.Kill(); // Try killing the process
private void MyExited(object sender, EventArgs e)
{
MessageBox.Show("Exited process");
}
This will run notepad "hidden" (for illustration purposes).. Then p.Kill();
should kill it.
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Mark Rae" <ma**@markrae.co.uk> wrote in message
news:up**************@TK2MSFTNGP10.phx.gbl...
"Selen" <sk*****@yahoo.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl... How can I run the program i.e.notepad.exe from asp.net c#?
Presumably, you mean you want to create a web page in ASP.NET which will
allow clients to run Notepad on their local machine? If so, just use WSH
and javascript:
<script>
var WshShell = new ActiveXObject("WScript.Shell")
WshShell.Run ("notepad.exe")
</script>