package com.lj.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class FFMpeg
{
public static void main(String[] args) throws IOException
{
List<String> command=new ArrayList<String>();
command.add("ipconfig");
command.add("/all");
Process process=new ProcessBuilder(command).start();
InputStream in=process.getInputStream();
int b=0;
StringBuffer sb=new StringBuffer();
BufferedReader br=new BufferedReader(new InputStreamReader(in,"gbk"));
String str="";
while((str=br.readLine())!=null){
System.out.println(str);
}
}
}
这里BufferedReader br=new BufferedReader(new InputStreamReader(in,"gbk"));
一定要设置成gbk,
之前设置成utf-8,结果出现乱码。
换成gbk就没问题了。