Command Line Parameters

J

Joiey.Seeley

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!
 
J

Joiey.Seeley

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.
 
E

Evertjan.

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);
}
 
J

Joiey.Seeley

Evertjan. said:
wrote on 04 okt 2005 in comp.lang.javascript:


Please always quote on usenet.
This is not email.


Try:

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

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

WshShell.Run();

followed by

WshShell.SendKeys();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top