今天做了一個測試,源碼是相當簡單的,地球人中的編程人員是都知道寫的,可是有個地方卻始終是被忽略的,IE的安全級別要更改,否則會禁止跳出你所調用的系統exe文件,核心的說了不多說了~~~~~~~~源碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function Run(strPath) {
//debugger;
exe.value = strPath;
try {
var objShell = new ActiveXObject("wscript.shell");
objShell.Run(strPath);
objShell = null;
}
catch (e) {
alert('找不到文件"' + strPath + '"(或它的組件之一)。請確定路徑和文件名是否正確,而且所需的庫文件均可用。')
}
}
</script>
</head>
<body>
請輸入要運行的程序:<br>
<input name="exe" type="text" size="20" value="regedit">
<button type="button" onclick="Run(exe.value)">
確定</button>
<button type="button" onclick="exe.value=''">
重新輸入</button><br>
<button type="button" onclick="Run('C:\\WINDOWS\\system32\\notepad.exe')">
記事本</button><br>
<button type="button" onclick="Run('C:\\WINDOWS\\system32\\mspaint.exe')">
畫圖板</button><br>
<button type="button" onclick="Run('C:\\WINDOWS\\system32\\calc.exe')">
計算器</button><br>
<button type="button" onclick="Run('C:\\WINDOWS\\system32\\cmd.exe')">
cmd</button><br>
<button type="button" onclick="Run('C:\\WINDOWS\\regedit.exe')">
注冊表</button><br>
<button type="button" onclick="Run('C:\\WINDOWS\\PCHealth\\HelpCtr\\Binaries\\msconfig.exe')">
Msconfig</button><br>
</body>
</html>
更改安全級別如下:

效果如下:

