package Shell;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* @author Kern
* @Title: Foo
* @ProjectName springmvcdemo
* @Description: TODO
* @date 2019/9/1916:28
*/
public class RunTimeToWindowCommand {
public static void main(String[] args) throws Exception {
System.out.println(exec("ipconfig"));
}
private static String exec(String... command) throws Exception {
String[] cmd = command;
StringBuilder out = new StringBuilder();
BufferedReader reader = null;
InputStream in = null;
try {
Process process = Runtime.getRuntime().exec(cmd);
in = process.getInputStream();
reader = new BufferedReader(new InputStreamReader(in,"gb2312"));
String line;
while ((line = reader.readLine()) != null) {
out.append(line + "\n");
}
process.waitFor();
} finally {
if (reader != null) {
reader.close();
}
}
String console = out.toString();
return console;
}
}
console
F:\environment\java_se_jdk_1.8\bin\java.exe "-javaagent:F:\application\IntelliJ IDEA 2019.2.1\lib\idea_rt.jar=53195:F:\application\IntelliJ IDEA 2019.2.1\bin" -Dfile.encoding=UTF-8 -classpath F:\environment\java_se_jdk_1.8\jre\lib\charsets.jar;F:\environment\java_se_jdk_1.8\jre\lib\deploy.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\access-bridge-64.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\cldrdata.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\dnsns.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\jaccess.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\jfxrt.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\localedata.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\nashorn.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\sunec.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\sunjce_provider.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\sunmscapi.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\sunpkcs11.jar;F:\environment\java_se_jdk_1.8\jre\lib\ext\zipfs.jar;F:\environment\java_se_jdk_1.8\jre\lib\javaws.jar;F:\environment\java_se_jdk_1.8\jre\lib\jce.jar;F:\environment\java_se_jdk_1.8\jre\lib\jfr.jar;F:\environment\java_se_jdk_1.8\jre\lib\jfxswt.jar;F:\environment\java_se_jdk_1.8\jre\lib\jsse.jar;F:\environment\java_se_jdk_1.8\jre\lib\management-agent.jar;F:\environment\java_se_jdk_1.8\jre\lib\plugin.jar;F:\environment\java_se_jdk_1.8\jre\lib\resources.jar;F:\environment\java_se_jdk_1.8\jre\lib\rt.jar;F:\responsitory\idea_responsitory\springmvcdemo\demo-ioc\target\classes;F:\responsitory\maven_responsitory\org\springframework\spring-context\4.3.11.RELEASE\spring-context-4.3.11.RELEASE.jar;F:\responsitory\maven_responsitory\org\springframework\spring-aop\4.3.11.RELEASE\spring-aop-4.3.11.RELEASE.jar;F:\responsitory\maven_responsitory\org\springframework\spring-beans\4.3.11.RELEASE\spring-beans-4.3.11.RELEASE.jar;F:\responsitory\maven_responsitory\org\springframework\spring-core\4.3.11.RELEASE\spring-core-4.3.11.RELEASE.jar;F:\responsitory\maven_responsitory\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;F:\responsitory\maven_responsitory\org\springframework\spring-expression\4.3.11.RELEASE\spring-expression-4.3.11.RELEASE.jar;F:\responsitory\maven_responsitory\org\springframework\spring-web\4.3.11.RELEASE\spring-web-4.3.11.RELEASE.jar;F:\responsitory\maven_responsitory\org\mybatis\mybatis-spring\2.0.2\mybatis-spring-2.0.2.jar;F:\responsitory\maven_responsitory\com\beust\jcommander\1.78\jcommander-1.78.jar Shell.RunTimeToWindowCommand
Windows IP 配置
无线局域网适配器 本地连接* 1:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
无线局域网适配器 本地连接* 2:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
以太网适配器 以太网:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::4d60:57ab:6f6b:60b1%18
IPv4 地址 . . . . . . . . . . . . : 192.168.10.22
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 192.168.10.1
无线局域网适配器 WLAN:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
Process finished with exit code 0
手机扫一扫
移动阅读更方便
你可能感兴趣的文章