ipconfig release.bat

Twistty

The Happy Beaver
Donor
Respected User
Former Staff
Sep 9, 2016
4,389
39,368
Looking for a bit of help making a bat file.

Basically these are commands I want to use


Code:
echo off
cls
ipconfig /release
pause
ipconfig /flushdns
pause
ipconfig /renew
pause
netsh winsock reset
pause
netsh interface ipv4 reset
pause
netsh interface ipv6 reset
pause
netsh winsock reset catalog
pause
netsh int ipv4 reset reset.log
pause
netsh int ipv6 reset reset.log
pause
exit
Not sure if the "pause" is needed?
But doesn't seem to work no matter what I tried?

Any ideas

Thanks ;)
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,960
16,195
Not sure if the "pause" is needed?
I don't think it's needed, normally each command you use should wait by itself that everything is done before returning. Keep just the last one to catch possible error messages.
As for the rest, it seem correct ; perhaps a little too much, but with Windows and networks it's not necessarily a bad idea.

Are you sure that it run at an administrator level ?
 
  • Like
Reactions: Twistty

Twistty

The Happy Beaver
Donor
Respected User
Former Staff
Sep 9, 2016
4,389
39,368
I don't think it's needed, normally each command you use should wait by itself that everything is done before returning. Keep just the last one to catch possible error messages.
As for the rest, it seem correct ; perhaps a little too much, but with Windows and networks it's not necessarily a bad idea.

Are you sure that it run at an administrator level ?
No sure anne O'nymous to be honest.
Tried it with both the pauses and without, cannot tell if it is working.
If I do them in cmd prompt - they seem to to their job, but as a bat file - do not think it is?
As it does not ask me to reboot - as it normally should?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,960
16,195
As it does not ask me to reboot - as it normally should?
Hmm... Why should it ask for a reboot ?

I'm not too familiar with script administration for Windows, so I can have missed something. But as far as I know, this script strongly reset the networks ; probably in order to be totally sure that the IP address will be renewed.
Therefore, not only it have no reason to ask for a reboot, but also a reboot would mean that all this was useless ; a reboot being nothing else than a fresh start-up without the "turn off then on" part for the computer itself.

If you say that because of the exit, it's not what it mean ; it's to close the DOS windows. If my memory don't betray me, rebooting Windows from the command line is done like for an *nix station (modulo the command prefix), with shutdown /r.
 
  • Like
Reactions: Twistty

Evil Modder™

New Member
Oct 29, 2020
9
57
You don't really need the echo off, but if you are going to include it start it with @ - @ echo off (without the space)
I would put flushdns after the renew command.
You only need one pause at the end like Anne said.
Also as Anne said, if you want the script to restart for you just have shutdown /r at the end, then it'll pop up a warning that the system will restart within one minute.
 

Twistty

The Happy Beaver
Donor
Respected User
Former Staff
Sep 9, 2016
4,389
39,368
Forgot to post the code that works for me now - lol


@ - Echo off
cls
ipconfig /release
ipconfig /flushdns
ipconfig /renew
netsh winsock reset
netsh interface ipv4 reset
netsh interface ipv6 reset
netsh winsock reset catalog
netsh int ipv4 reset reset.log
netsh int ipv6 reset reset.log
pause
shutdown /r


Does everything I wanted now!
 

I'm Not Thea Lundgren!

AKA: TotesNotThea
Donor
Jun 21, 2017
6,604
19,025
Forgot to post the code that works for me now - lol


@ - Echo off
cls
ipconfig /release
ipconfig /flushdns
ipconfig /renew
netsh winsock reset
netsh interface ipv4 reset
netsh interface ipv6 reset
netsh winsock reset catalog
netsh int ipv4 reset reset.log
netsh int ipv6 reset reset.log
pause
shutdown /r


Does everything I wanted now!
That's a pretty major network reset, what are you trying to do? :eek: :devilish:
 
  • Haha
Reactions: Twistty

I'm Not Thea Lundgren!

AKA: TotesNotThea
Donor
Jun 21, 2017
6,604
19,025
Changed from using nordvpn to expressvpn as my "daily" and also use mullgardvpn for?
Just being careful when changing services is all.
I use a VM if I don't want a trace leaving behind, if it's something quick where you don't need to save anything you did, Windows Sandbox is pretty snappy.
 
  • Like
Reactions: Twistty

I'm Not Thea Lundgren!

AKA: TotesNotThea
Donor
Jun 21, 2017
6,604
19,025
Changed from using nordvpn to expressvpn as my "daily" and also use mullgardvpn for?
Just being careful when changing services is all.
Also, if you need a quick and dirty solution, Windows Sandbox paired with Windscribe VPN will hide most online sins; Windscribe gives 2GB free bandwidth and you don't even need an email address. ;)
 

Twistty

The Happy Beaver
Donor
Respected User
Former Staff
Sep 9, 2016
4,389
39,368
I use a VM if I don't want a trace leaving behind, if it's something quick where you don't need to save anything you did, Windows Sandbox is pretty snappy.
Thats good advice Thea!

ps. Hope all is well with you - last time we spoke - was just before "corona" kicked me on my butt work wise.

Windscribe - Lol already have 2 paid services as mentioned above :oops:
 

Twistty

The Happy Beaver
Donor
Respected User
Former Staff
Sep 9, 2016
4,389
39,368
Good have been back here for about 2 months now.
Still have to look at your site, just getting caught up with all my online stuff - was nice talking to the Dev. Jack - glad he is starting to feel better.

Ps. Thought the "Thea" would be corrected again if you saw it? :p