This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you prevent command prompt pop-up/close it after a /C Start command?

 
Wayne Liu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As stated in the topic, can anyone show me the codes i need to prevent a command prompt pop up or close it after running a /C Start command? The code below will start a command prompt and "echotoscreen" is a .bat file with "echo %1, echo%2" commands that will accept the variables "msg" and "hp" respectively. Any help will be greatly appreciated! Thanks.

-------------------------------------------------
import java.io.*;

public class Test4 {
public static void main(String args[])throws IOException
{
String msg = "\"Your OTP is 493043\"";
String hp = "93495029";
Process p=Runtime.getRuntime().exec("cmd /C start echotoscreen " + msg+" " +hp);
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
while(line!=null)
{
System.out.println(line);
line=reader.readLine();
}

}

}

-------------------------------------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic