By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,481 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,481 IT Pros & Developers. It's quick & easy.

Command Line Parameters

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

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.