excute command

M

mory2311

Hi all,

I'm asking about how to excute DOS command via Java code ?

can anybody guid me ?

thank you
 
R

Robert Mark Bram

Hello,
I'm asking about how to excute DOS command via Java code ?


Start with this:
Runtime.getRuntime().exec("/path/to/batchFile.bat");

The thing you are executing must always resolve to the path of some
file you are going to run.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)

You can use another form of exec in the same class where you send in a
string array to encapsulate arguments to the script as different array
positions. However, even the form above that accepts a String only can
also include space separated arguments.

Good luck,

Rob
:)
 

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
474,269
Messages
2,571,098
Members
48,773
Latest member
Kaybee

Latest Threads

Top