用于配置我的网络设置的批处理文件
我想编写一个批处理,其效果如下。 这是我手动执行的操作(我想对其进行编程以自动执行):
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
取自此处:http://support.microsoft.com/kb/257748
您可以使用netsh 执行所有网络设置操作。例如:
Taken from here: http://support.microsoft.com/kb/257748
You can use netsh to perform all of the network setting manipulation. For example:
也许这个特定的工作最好使用基于 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/