run .vbs file

can java run a .vbs file? and pass it a value?
LVL 16
ellandrdAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
not directly. You'd need to use wither Runtime.exec() or JNI.
0
 
CEHJConnect With a Mentor Commented:
Yes, java can execute any command (Runtime.exec())
0
 
ellandrdAuthor Commented:
and pass it a value?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
CEHJConnect With a Mentor Commented:
The value is passed in with the program args to Runtime.exec
0
 
objectsConnect With a Mentor Commented:
> and pass it a value?

sure, if using exec() you'd pass it the same way you pass any arg to an application
if using JNI, you'd pass the value as a parameter to the JNI function.
0
 
ellandrdAuthor Commented:
so say something like:

Runtime.getRuntime().exec( "http://192.168.0.2/file.vbs?value=" + value ) ;
0
 
CEHJConnect With a Mentor Commented:
No. The test is to run it in the same way as you would invoke the vb interpreter from the command line
0
 
objectsConnect With a Mentor Commented:
> Runtime.getRuntime().exec( "http://192.168.0.2/file.vbs?value=" + value ) ;

no, you'd need to pass the vbs file to an interpreter to run it
and in your case one that was capable of running it from a url

0
 
ellandrdAuthor Commented:
thank you!
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.