How can I run a program in a HTML script?

source: http://www.vandyke.com/support/securecrt/004.html

You cannot run programs directly in an ActiveX script however if you have Microsoft’s Windows Script Host (WSH) installed you can tell WSH to run it for you.

The following VBScript statements use WSH to start Internet Explorer with a command-line argument:

Dim shell
Set shell = CreateObject(“WScript.Shell”)
shell.Run “””C:\Program Files\Internet Explorer\IExplore.exe””http://www.vandyke.com

Here’s the same thing in JScript:

var shell = new ActiveXObject(“WScript.Shell”);
shell.Run(“\”C:\\Program Files\\Internet Explorer\\IExplore.exe\”http://www.vandyke.com“);

Note, the Run() function uses whitespace to separate program names from possible command-line arguments. In order to deal with paths with spaces it is necessary to add extra quotes in both languages to make it clear.

For information and downloads related to WSH look for the “Windows Script Host” section at:

http://msdn.microsoft.com/en-us/library/ms950396.aspx

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: