問題描述:
我的目的是使用php啓動外部的某個可執行文件,該代碼已經實現併成功運行,代碼如下:
<script type="text/javascript">
<!--
function runExecutable()
{
'var executableFullPath = 'D:\\php\\wamp\\www\\EzRegistration.exe'; ';
try
{
var shellActiveXObject = new ActiveXObject("WScript.Shell");
if ( !shellActiveXObject )
{
alert('Could not get reference to WScript.Shell');
return;
}
shellActiveXObject.Run(executableFullPath, 1, false);
shellActiveXObject = null;
}
catch (errorObject)
{
alert('Error:\n' + errorObject.message);
}
}
// -->
</script>
該代碼的問題在於display_vc.exe運行期間,cmd窗口始終存在,只有exe程序關閉了,cmd窗口才會自動關閉。
所以,有沒有哪位達人知道如何才能使cmd窗口一啓動外部程序便能夠自動關閉?萬分感謝!
|