Windows:重新启动时网络接口号更改
我想将路线添加到网络,从原则上讲,它可以正常工作。 但是,接口号一直在变化,因此我需要在重新启动后修改路线。
示例:
route ADD 10.0.0.0 MASK 255.0.0.0 8.8.8.8 METRIC 5 IF 14
这起作用,直到接口ID从更改为14
为,如果15 。 是否可以将接口编号固定,或者如果没有,则可以从接口名称中动态检索接口号。
I want to add routes to a network and in principle it works fine.
However, the interface numbers keep changing and so I need to adapt the routes after every reboot.
Example:
route ADD 10.0.0.0 MASK 255.0.0.0 8.8.8.8 METRIC 5 IF 14
This works until the interface ID changed from IF 14
to IF 15
.
Is it possible to keep the interface numbers fixed, or if not, dynamically retrieve the interface number from the interface name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否考虑过使用PowerShell?
像
一个人可以使用批次脚本来做这项工作.....
这是一个开始:(
以太网
或*Ether*
,是我获取所需的NIC的方式。在我的情况下,仅其名称包含Ether
)注意 - 如果您选择批处理解决方案(不建议使用..),
从批处理文件运行时,必须在
%g
中使用另一个'%'逃脱“%”。Have you considered using Powershell?
something like
one could make this work using Batch scripting.....
here's a start:
(
Ethernet
, or*Ether*
, is my way to get the desired NIC. in my case, only its name containsEther
)Note - if you opt for the Batch solution (not recommended..),
when running from a batch file, you must escape the '%' using another '%', in
%g
.