js呼び出しシステムコマンド

840 ワード

<script language="jscript">
alert("test");
function exec (command) {
     try{
        window.oldOnError = window.onerror;
        window._command = command;
        window.onerror = function (err) {
        if (err.indexOf(utomation) != -1) {
            alert(   + window._command +        !);
            return true;
        }else
            return false;
        }
        var wsh = new ActiveXObject("WScript.Shell");
        if (wsh)
            wsh.Run(command);
        window.onerror = window.oldOnError;
		}catch(e){
			alert(window.onerror+"eroor:"+e);
		}
    }
	alert(exec("g++ hello.c"));
	alert("g++");
</script>