Opening a Command Prompt Window from javascript
843838May 10 2006 — edited May 10 2006Hi Friends,
I have written a javascript code to open a command prompt window..
But it is not working can u help me by replying as soon as possible.....
var strCommand; //This is the command to be executed
var strStyle = 1; //This controls whether a command prompt will pop up or not
var strWait = true ; //Determines if the script will wait for the child to complete or not
var strArgs; // Arguments that you want to hand to the child process
strCommand = "c:\\winnt\\system32\\cmd.exe";
strArgs = "test.bat";
alert(strCommand);
var shell = WScript.CreateObject("WScript.Shell");
alert(shell);
var rcode = shell.Run(strCommand + " " + strArgs, strStyle, strWait);
alert(rcode);
shell.Popup("Return code is " + rcode);
This code is not able to open the command prompt window.
Bye