你需要躲避反斜槓,例如,
var commandtoRun = "C:\\Documents and Settings\\User\Desktop\\ABCD.exe";
更新:
此工程在我的機器上的罰款:
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Windows\\notepad.exe";
oShell.ShellExecute(commandtoRun,"","","open","1");
更新2
你可以sa這已經與擴展.hta
一個文件,它應該在你的瀏覽器中工作:
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Application Executer"
BORDER="no"
CAPTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
SCROLL="no"
WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Windows\\notepad.exe";
oShell.ShellExecute(commandtoRun,"","","open","1");
</script>
發現了一個小的搜索這一點 - http://www.dotnetspider.com/resources/19547-Run-exe-file-Java -Script.aspx – JasCav 2010-06-30 19:04:10
你在製作病毒還是什麼? :) – 2016-07-18 09:32:33