如何使用asp.net4从网页启动EXE

时间:2012-12-09 21:30:59

标签: javascript internet-explorer wsh jscript

我使用此代码:

<script>
function LaunchApp() {
    if (!document.all) {
        alert("Available only with Internet Explorer.");
        return;
    }
    var ws = new ActiveXObject("WScript.Shell");
    ws.Exec("C:\\Windows\\notepad.exe");
}


<a href="javascript:LaunchApp()">Launch the executable</a> 

但这不起作用。 (链接已禁用)

1 个答案:

答案 0 :(得分:2)

  1. 您没有指向相同的JavaScript函数。试试这个:

    <button onclick="LaunchApp()">Run Exe File</button>

  2. 您的互联网设置必须设置为最低安全级别才能运行此类代码。