且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Java执行Windows命令 - 更改网络设置

更新时间:2023-12-03 23:40:40

Runtime.getRuntime().exec("netsh");

参见运行时 Javadoc。

See Runtime Javadoc.

编辑:leet后来的回答表明此过程现已弃用。但是,根据DJViking的评论,情况似乎并非如此: Java 8文档。该方法不推荐使用。

A later answer by leet suggests that this process is now deprecated. However, as per the comment by DJViking, this appears not to be the case: Java 8 documentation. The method is not deprecated.