Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question about cmd.exe /k

843798Mar 17 2010 — edited Mar 19 2010
I can write the code below to start cmd.exe to stay and not end:
Process p=Runtime.getRuntime().exec("cmd.exe /K ver"); // for example.
InputStream in=p.getInputStream();
InputStream err=p.getErrorStream();
Now how do I send another command to this process p and capture its output?
OutputStream o=p.getOutputStream();
Can someone help? I just want to run one copy of cmd.exe.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 16 2010
Added on Mar 17 2010
1 comment
151 views