try {
File f=new File("D:\\testbat.txt");
String str="@echo off\r\necho helloword\r\nnotepad d:\\jieyaTest2.java\r\nexit";
File f2=new File("D:\\battest.bat");
FileOutputStream fos=new FileOutputStream(f);
DataOutputStream dos=new DataOutputStream(fos);
dos.writeBytes(str);
dos.flush();
dos.close();
fos.close();
f.renameTo(f2);
Process pro=Runtime.getRuntime().exec("cmd.exe /c start "+f2);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这么一个类 我运行后dos窗口老是显示如何让它消失应该加上什么代码
File f=new File("D:\\testbat.txt");
String str="@echo off\r\necho helloword\r\nnotepad d:\\jieyaTest2.java\r\nexit";
File f2=new File("D:\\battest.bat");
FileOutputStream fos=new FileOutputStream(f);
DataOutputStream dos=new DataOutputStream(fos);
dos.writeBytes(str);
dos.flush();
dos.close();
fos.close();
f.renameTo(f2);
Process pro=Runtime.getRuntime().exec("cmd.exe /c start "+f2);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这么一个类 我运行后dos窗口老是显示如何让它消失应该加上什么代码
解决方案 »
- FTPClient在大规模并发下载的情况下,总是出现阻塞,请问有没有线程安全的FTP客户端类?
- JAVA数字签名用C++验证签名
- !!!在线急等~关于ResultSet和NullPointerException
- 请问这个提示是什么错误?
- 命令行下编译,用JDBC连microsoft sql server 2000时,总是找不到com.microsoft这个包
- 同一个包里面的类引用出错,怎么解决呢??????????????????????????
- 在一个Vector中放入了一个String[],我应该怎么重新把他取出来也保存在一个String[]中?——解决立马给分
- 为什么每次我离开这个窗口,再回来他会变花,有什么办法解决
- java如何调用com?
- 以下几本书籍哪儿有down?
- 菜鸟求助,Date类与GregorianCalender类的区别是什么呢?
- 怎么查看动态网页
pro.destroy();
用这个也可以
org.eclipse.swt.program.Program.launch("a.bat");
The javaw.exe command is identical to java.exe, except that with javaw.exe there is no associated console window. This implies you can't get it to display the version with -version since there is no console to display it on. Use javaw.exe when you don't want a command prompt window to appear. The javaw.exe launcher will, however, display a dialog box with error information if a launch fails for some reason.