Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1561 How do I write a link which opens notepad.exe?

You are here: irt.org | FAQ | HTML | Q1561 [ previous next ]

Here is a text on execution I wrote some time ago...

For Internet Explorer I would suggest you look really hard at Windows Scripting Host (WSH) at http://www.microsoft.com/scripting/default.htm?/scripting/windowshost/default.htm. Example:

<script language="vbscript">
Set WshShell = CreateObject("WScript.Shell")

Sub runlink_onClick()
  WshShell.Run "c:\\WINNT\\Explorer.exe c:\\WINNT", 1, 0
 End Sub

and in the page have:

<a name="runlink">Run</a>

You will get the following when loading:

"An activex object on this page may be unsafe. Do you want to allow it to initialize and be accessed by scripts?"

One possibility is to use the PC Magazine programme WINCMD. This permits the launching of programmes from hyperlinks which target text files. The text files contain the launch command(s), and have a .wcm extension which is associated with the WINCMD programme. The WINCMD programme ensures execution of the launch command(s).

Another is:

Create a dos batch file that calls your program:

@echo off
C:\WINNT\Explorer C:\WINNT

Set your link to the bat file.

If using Netscape, you'll have to define a Helper appl for the .bat extension, perhaps command.com as a helper?

For just executing (probably without parameters - I had little time to dig out the old browsers you could do the following (courtesy of JCS):

* 1 - setup the browser to accept running .exe instead of saving them: -in Netscape Navigator 3, go the list of: Options|General prefs|Helper apps In the list, locate and select "application/octet-stream", and set it up with the "Launch application" action. -in Netscape Navigator 4, go to: Edit|Preferences|Navigator|Applications Then click on the "New type" button. Enter: Description: EXE file Extension : exe MIME type : application/exe Action : "%1" %* - There's nothing to add in Internet Explorer 3. * 2 - In your page, just have your link: <A HREF="file:///C:\WINDOWS\Calc.exe">CALC.EXE</A> * 3 - When you click the link: - Netscape Navigator 3 will show you the default "Save as..." dialog box. Just click the "Cancel" button, and Calc.exe will be launched. - Netscape Navigator 4 will show you the "What do you want me to do with that file" dialog, with options to open it or save it. Select "open" and click "OK". Calc.exe will be launched. - Internet Explorer 3 will prompt you for action, then warn you it's unsecure to run an unsigned exe file, then will launch calc.exe

©2018 Martin Webb