0

我想编写一个程序来重置用户的局域网/(TCP/IP)属性。

这是我手动执行的操作(我想自动编程):

1) START -> Run -> cmd (get command prompt)
2) ipconfig /release
3) START -> Connect to -> Show all connections
4) Right-click "Local Area Network" and click "Properties"
5) Highlight "Internet Protocol (TCP/IP) and click "Properties"
6) Check box "Use the following IP Address"
7) Enter "111.111.111.111" for IP address
8) Enter "255.0.0.0" for Subnet mask
9) Click OK, and Close.
10) Wait 20 seconds
11) START -> Connect to -> Show all connections
12) Check box for "Obtain IP address automatically"
13) Click OK, and close.
14) Wait 20 seconds.

我想通过我的 java 程序执行以上 14 个步骤。我该怎么做?是否有任何 api 允许我设置上述参数。必须保存更改,即使我重新启动我的电脑也应该保留。我想要 pragram当我启动我的电脑时,只运行一次,而不是每次运行。

4

2 回答 2

1

您似乎正在尝试使用 DHCP 更新您的 IP 地址。

编写以下批处理文件,而不是编写 Java 程序:

ipconfig /renew
于 2009-10-25T20:53:45.540 回答
0

仅通过Runtime.exec(如 SLaks 所述)或使用JNI。据我所知,没有能够处理此问题的本机 JAVA 库。

于 2009-10-25T21:02:27.260 回答