赞
踩
public class procee {
public static void main(String[] args) {
try {
Process process = Runtime.getRuntime().exec("ipconfig /all");
InputStreamReader ir = new InputStreamReader(process
.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line;
while ((line = input.readLine()) != null)
if (line.indexOf("Physical Address") > 0) {
String MACAddr = line.substring(line.indexOf("-") - 2);
System.out.println("MAC address = [" + MACAddr + "]");
}
} catch (java.io.IOException e) {
System.err.println("IOException " + e.getMessage());
}
} }
private boolean upzipTar(String fileName, String targetPath){ Runtime run = Runtime.getRuntime(); if(!fileIsExist(fileName)){ log.debug(fileName+" not found!"); //文件不存在 return false; } String cmd = "tar xZf " + fileName + " -C " + targetPath; try { Process process = run.exec(cmd); BufferedReader in = new BufferedReader( new InputStreamReader(process.getInputStream())); if(in.readLine() != null){ //解压缩失败 log.error("unzip fail "+fileName); return false; }else{ //解压缩成功 log.info(" success unzip "+ fileName); } } catch (IOException e) { log.error("IOException occured"+e.getMessage()); } return true; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。