This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes console window flash Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "console window flash" Watch "console window flash" New topic

console window flash

shilpa reddy

Joined: Dec 12, 2000
Posts: 29
I am passing certain parameters to the os using Runtime.getRuntime.exec() method.
However the console window flashes briefly while the command gets executed.
How can I prevent this ?
Thanks in advance,
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
What "certain parameters" are you passing? What String or String array are you using as an argument to the exec() method?
[This message has been edited by Jim Yingst (edited April 30, 2001).]

"I'm not back." - Bill Harding, Twister
shilpa reddy

Joined: Dec 12, 2000
Posts: 29
Hi Jim,
I am trying to retrieve a system property from Windows NT environment. The following is the command passed -
String str = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(new String[]{"cmd.exe", "/cset","KEY"}).getInputStream())).readLine();
KEY the environment variable for which I am trying to retrieve the value.
This is successful except the console window seems to flash briefly.
I have tried to set echo off in the same command ,i.e -
Runtime.getRuntime().exec(new String[]{"cmd.exe", "@echo off","/cset","KEY"}. This has not worked.
Any suggestions?
I agree. Here's the link:
subject: console window flash
It's not a secret anymore!