Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run an external program, e.g. notepad, using hyperlink?

Tags:

I'm generating an HTML report by C# to print pairs of files in a table which has 3 columns: the first two columns used for the filenames and the 3rd column is a hyperlink Compare - I want this link to run WinMerge to compare to two files and I currently don't know how to do it.

like image 697
Nam G VU Avatar asked May 10 '10 02:05

Nam G VU


1 Answers

Try this

<html>     <head>         <script type="text/javascript">         function runProgram()         {             var shell = new ActiveXObject("WScript.Shell");                              var appWinMerge = "\"C:\\Program Files\\WinMerge\\WinMergeU.exe\" /e /s /u /wl /wr /maximize";             var fileLeft = "\"D:\\Path\\to\\your\\file\"";             var fileRight= "\"D:\\Path\\to\\your\\file2\"";             shell.Run(appWinMerge + " " + fileLeft + " " + fileRight);         }         </script>     </head>      <body>         <a href="javascript:runProgram()">Run program</a>     </body> </html> 
like image 53
Nam G VU Avatar answered Sep 17 '22 15:09

Nam G VU