用于配置我的网络设置的批处理文件

发布于 2024-08-08 16:57:01 字数 642 浏览 5 评论 0原文

我想编写一个批处理,其效果如下。 这是我手动执行的操作(我想对其进行编程以自动执行):

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.

i want to write a batch which will have the same effect as follows.
Here's what I do manually (which I want to program to do automatically):

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

转瞬即逝 2024-08-15 16:57:01

取自此处:http://support.microsoft.com/kb/257748

您可以使用netsh 执行所有网络设置操作。例如:

netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1

Taken from here: http://support.microsoft.com/kb/257748

You can use netsh to perform all of the network setting manipulation. For example:

netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1
把人绕傻吧 2024-08-15 16:57:01

也许这个特定的工作最好使用基于 GUI 的宏记录器来完成。
除此之外,使用脚本操作 Windows 的最强大工具是 WMI 和 WMI 控制台。然而它相当复杂,请查看维基百科以获取更多信息。这两个链接可能会帮助您入门:

http://quux.wiki.zoho.com/ WMIC-Snippets.html

http:// codeslammer.wordpress.com/2008/02/21/wmic-a-hidden-gem/

Maybe this particular job is done best using a GUI based macro recorder.
Otherwise, the most powerful instrument for manipulating Windows using scripts is WMI and the WMI console. It's quite complex however, check Wikipedia for more information. These two links might get you started:

http://quux.wiki.zoho.com/WMIC-Snippets.html

http://codeslammer.wordpress.com/2008/02/21/wmic-a-hidden-gem/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文