Java 调用批处理文件另类方法
http://www.diybl.com/ 2007-12-6 网络 点击:
[ 评论 ]
文章搜索:
【点击打包该文章】
import java.io.*;
public class Test
{
public static void main(String[] args)
{
System.out.println("args : " + java.util.Arrays.asList(args));
try
{
String command = args.length == 0 ? "notepad" : args[0];
Process child = Runtime.getRuntime().exec(command);
String line = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream()));
while((line = reader.readLine()) != null)
{
System.out.println(line);
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
如果图片或页面不能正常显示请点击这里 站内搜索:
推荐文章 |
