JavaScript cannot usually call external objects on the client machine. If
you could, then the Web would be too insecure for any business to allow
people to surf. However, if the security settings are set correctly, and you
are using IE, in JScript there is an ActiveXObject() function that allows
you to open things like an Excel object and access things like an SMTP
server.
The command that does the command prompt is command.com on Win98 and earlier
machines, and cmd.exe on NT-based machines. I know command.com isn't an
ActiveXObject and searching through my registry using regedit on a Win2K
machine shows that neither is cmd.exe. You can pass commands to these
applications. With Command.com you used to pass them using the -c switch,
with the command specified in quotes. It is probably the same for cmd.exe.
I suspect you can make use of the WSH ActiveXObject to do it. However, like
a fool, I never learned how to use the Windows Scripting Host and so I am
stuck with the same limitations that DOS users have had with batch files
:-( Perhaps someone else can help there.
-----Original Message-----
From: Greg Griffiths [mailto:greg2@s...]
Sent: 06 December 2002 07:18
To: JavaScript HowTo
Subject: [javascript_howto] Re: Open a dos prompt with Javascript?
I think that you may have major problems with the security model in JS.
At 13:55 05/12/02 +0000, you wrote:
>Hi,
>
>Is it possible to open a dos prompt using javascript?
>
>I have an ASP page that lists IP's and URL's. When the page is being
>built, I just use a function that does a window.open to open a new window
>for that address.
>
>But now I am being asked to open a dos prompt and passing some commands to
>that prompt.
>
>Is this possible in JavaScript?
>
>Thanks,
>Mark
--------------------------------------------------------------
Peer Information India Pvt Ltd, Mumbai, India