How to call exe from webpage


Step 1: Create button

Add three buttons, for notepad, calculator and command prompt. Further add style to the button.

WebpageExe1.gif

Step 2: Generate Click event of button

Generate Click event for each button.

Step 3:Call exe using System.Diagnostics

On the click event of first button place following code

         System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\notepad.exe");

On the click event of second button place following code
 

    System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\calc.exe");
 
On the click event of third button place following code

    System.Diagnostics.Process.Start("C:\\WINDOWS\\system32\\cmd.exe");

The start method is used to execute an exe from web page. The start method is a member of Process class which is under System.Diagnostics name space.

Step 4: Click on any button

Clicking on Notepad button will open notepad from the specified path in the click event

WebpageExe2.gif
Clicking on Calculator button will open Calculator from the specified path in the click event

WebpageExe3.gif
Clicking on Command Prompt button will open Command Prompt from the specified path in the click event WebpageExe4.gif