Java获取CPU序列号

获取CPU序列号

 1  /**
 2      * 获取CPU序列号
 3      * @return
 4      */
 5     public static String getCpuId() throws IOException {
 6         Process process = Runtime.getRuntime().exec(
 7                 new String[]{"wmic", "cpu", "get", "ProcessorId"});
 8         process.getOutputStream().close();
 9         Scanner sc = new Scanner(process.getInputStream());
10         String property = sc.next();
11         String serial = sc.next();
12         System.out.println(property + ": " + serial);
13         return serial;
14     }

作者:彼岸舞

时间:2020\06\24

内容关于:工作中用到的小技术

本文部分来源于网络,只做技术分享,一概不负任何责任

posted @ 2020-06-24 16:15  彼岸舞  阅读(2580)  评论(0编辑  收藏  举报