“修复"以编程方式/来自命令行的网络连接 [英] "Repair" network connections programmatically/from command line

查看:20
本文介绍了“修复"以编程方式/来自命令行的网络连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在网络连接上单击修复"时,有谁知道 Windows XP 究竟做了什么?我想以编程方式或从命令行执行相同的操作.

Does anyone know exactly what Windows XP does when you click "Repair" on a network connection? I'd like to do the same programmatically or from a command line.

我在 Google 上搜索并找到了 这篇文章,有很好的解释,但我认为它不完整.我可以可靠地重现丢失网络连接并单击修复按钮修复问题的情况,但运行该文章中的命令没有.

I did a Google search and found this article, which has a good explanation, but I don't think it's complete. I can reliably reproduce a condition where I lose network connectivity and clicking the Repair button fixes the problem, but running the commands in that article does not.

推荐答案

谢谢,伙计们,我想我明白了.lpfavreau 发布的 MS KB 文章中的步骤几乎 完成.这就是我尝试过的,但没有奏效.但是,如果我先执行 ipconfig/release 那么它似乎可以工作.我怀疑修复"按钮在没有明确记录的情况下会这样做.对于我的特殊情况,我还必须清除路线(route -f").所以,我最后运行的命令是:

Thanks, guys, I think I figured it out. The steps in the MS KB article posted by lpfavreau are almost complete. That's what I tried and it didn't work. However, if I do ipconfig /release first then it seems to work. I suspect that the "Repair" button does that without it being explicitly documented. For my particular case I also had to clear the routes ("route -f"). So, the commands I ended up running in the end are:

route -f
ipconfig /release
ipconfig /renew
arp -d *
nbtstat -R
nbtstat -RR
ipconfig /flushdns
ipconfig /registerdns

我还发现了一些 C 代码来调用实际的修复连接"功能,尽管我还没有测试过 - 见这里的最后一篇文章.

I also found some C code to call the actual "Repair Connections" functionality, though I haven't tested it - see last post here.

这篇关于“修复"以编程方式/来自命令行的网络连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆