Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
637 views
in Technique[技术] by (71.8m points)

winapi - "Repair" network connections programmatically/from command line

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...