Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Opening a Command Prompt Window from javascript

843838May 10 2006 — edited May 10 2006
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2006
Added on May 10 2006
1 comment
802 views