import java.io.*;
public class ProcessTest {
public static void main(String args[]) throws IOException {
Process p = new ProcessBuilder("ipconfig").start();
InputStream is = p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}
}
运行结果:
C:\java>java ProcessTest
Windows IP Configuration
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 10.10.1.99
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . : 10.10.1.2
C:\java>
</td> <td width="236" valign="top" class="ArticleTeitle">
↑返回目录
前一篇: 简单的HTTP服务器和客户端
后一篇: ping局域网IP的多线程程序