我知道在JavaScript中运行.bat文件会涉及一些浏览器问题,但是下面的代码在Chrome和IE上都无法工作。
<html>
<head>
<script type="text/javascript">
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run (which,1,true);
}
</script>
</head>
<body>
<!-- Two ways to create a link to run the app. -->
<font onClick="runApp('file:C:/path/to/batfile.bat');" style="cursor: hand;"><u>Notepad</u> </font>
<br>
<!-- Or use <a> descriptor -->
<a href="runApp('file://c:/test.bat');">Batch File</a>
</body>
</html>
<font>
标签...不管你从哪里得到这个例子,都要找另一个来源。 - Pointyfile:///
- mshsayem