一个在HTML使用JavaScript实现调用Windows Shell.Application的例子。

<html>

<script>

function fnShellExecuteJ()
{
var objShell = new ActiveXObject("Shell.Application");

//objShell.ShellExecute("notepad.exe", "", "", "open", 1);

objShell.ShellExecute("mstsc.exe","/v:shd-entqa-001","","",1);

}

</script>
<body>Test<br>
Click <a href="javascript: void fnShellExecuteJ()">Here to connect</a> shd-entqa-001!
</body>

</html>

客户端IE还需做一下安全设置。

If you insist on doing this, go to Tools -> Internet Options -> Security tab ->
Internet Zone -> Custom Level...

Change "Initialize and script ActiveX controls not marked as safe" to either
"Prompt" or "Enable"

A better choice might be:

Tools -> Internet Options -> Security tab -> Trusted sites Zone -> Sites...

Enter the domain name of the site you'd like the script to run from in the "Add
this Web site to the zone:" text box and click "Add". If the site is not https:,
you'll need to uncheck the "Require server verification (https:) for all sites
in this zone" checkbox before clicking "Add".

你可能感兴趣的:(JavaScript,html,windows,IE,Security)