Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, first of all thank you in advance for any help.

I would like to run a client program from a web page. The scenario like when I click a "Run notepad" button on a web site, it will start notepad.exe in my computer.

I have tried .hta, and it can run well. But I have to save .hta to my computer and run it. All I want to do is just run notepad.exe directly by clicking a button on my website.

Please help me with this.
Posted

 
Share this answer
 
Comments
namhung1986 26-Jul-13 4:00am    
hi,
I followed your solution, but it didn't work. Please check it out. Thanks anyway!
XML
<html>
 <head>
     <script language="JavaScript" type="text/javascript">
         MyObject = new ActiveXObject( "WScript.Shell" )
         function RunNotePad()
         {
            MyObject.Run("notepad") ;
         }

    </script>
 </head>
 <body>
    <h1>Run a Program</h1>
    This script launch the file >> c:\windows\notepad.exe<p>
    <button onclick="RunNotePad()">Run Windows NotePad</button>
 </body>
</html>



Quote:
Similarly if u want to run another command MyObject.Run(notepad); just change Notepad with your run command like CMD, Explorer etc
 
Share this answer
 
Comments
namhung1986 29-Jul-13 21:23pm    
Hi,
Your solution is perfect, but just on IE. I cannot run it on Firefox and Chrome. Please suggest me another way at your convenience. Thank you so much!
Tomsanu Elena Georgiana 17-Mar-14 11:53am    
What about the same situation in Chrome? Thank you!

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