470,855 Members | 1,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

Command Line Parameters

I would like to run a command line program from within my Javascript.
This is a standalone script not running in a browser. This is also
running on Windows. I have tried using the WshShell.AppActivate method
and the WshShell.Exec method. I am able to run a command line program
with either of those, but am not able to pass in parameters so it is
essentially useless. Can someone tell me how I can do this? An
example as simple as how to run something like "ping -t google.com"
would be great.

Thanks in advance!

Oct 4 '05 #1
4 6463
Jo**********@gmail.com wrote:
I would like to run a command line program from within my Javascript.
This is a standalone script not running in a browser. This is also
running on Windows. I have tried using the WshShell.AppActivate method
and the WshShell.Exec method. I am able to run a command line program
with either of those, but am not able to pass in parameters so it is
essentially useless. Can someone tell me how I can do this? An
example as simple as how to run something like "ping -t google.com"
would be great.

Well, you would probably be best served with a servlet or cgi
that was set up with permissions to run the program and giftwrapped
it in an http response

This would allow you to use XMLHTTP or a hidden frame
to revceive the ping results to relay to the webpage
without a page reload.
--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> Internet Programming since 1994 <>=-- DHTML NSAPI TCP/IP
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Oct 4 '05 #2
Your answer does not seem to apply here. I am not talking about a web
application. This is a windows shell script built in JavaScript. It
is a script designed to handle large volumes of file parsing and
distribution. This script has no interactivity with a browser or with
users. It silently runs as a batch utility.

Oct 4 '05 #3
wrote on 04 okt 2005 in comp.lang.javascript:
Your answer does not seem to apply here.
Please always quote on usenet.
This is not email.
I am not talking about a web
application. This is a windows shell script built in JavaScript. It
is a script designed to handle large volumes of file parsing and
distribution. This script has no interactivity with a browser or with
users. It silently runs as a batch utility.


Try:

function runMe(myPath)
{
var myShell = new ActiveXObject("WScript.Shell");
myShell.Run(myPath, 1, true);
}

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 4 '05 #4

Evertjan. wrote:
wrote on 04 okt 2005 in comp.lang.javascript:
Your answer does not seem to apply here.


Please always quote on usenet.
This is not email.
I am not talking about a web
application. This is a windows shell script built in JavaScript. It
is a script designed to handle large volumes of file parsing and
distribution. This script has no interactivity with a browser or with
users. It silently runs as a batch utility.


Try:

function runMe(myPath)
{
var myShell = new ActiveXObject("WScript.Shell");
myShell.Run(myPath, 1, true);
}

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Thanks. This was more along the lines of what I needed. I ended up
using

WshShell.Run();

followed by

WshShell.SendKeys();

Oct 4 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Naina | last post: by
2 posts views Thread by Erik Wikström | last post: by
1 post views Thread by slonocode | last post: by
16 posts views Thread by John Salerno | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.