📄 获取网卡mac地址 .txt
字号:
/**
* 获取网卡MAC地址
*/
public static String getMacOnWindow() {
try {
String mac = null;
Process process = Runtime.getRuntime().exec("ipconfig /all");
BufferedReader buffer =
new BufferedReader(new InputStreamReader(process.getInputStream()));
for (String line = buffer.readLine(); line != null; line = buffer.readLine()) {
int index = line.indexOf("Physical Address");
if (index <= 0) {
continue;
}
mac = line.substring(index + 36);
break;
}
buffer.close();
process.waitFor();
return mac;
} catch (Exception exception) {
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -