Restart Windows Network

Windows specific forum
Randy Walker
Addict
Addict
Posts: 1058
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Restart Windows Network

Post by Randy Walker »

Free to do with as you like:

NOTE: You MUST enable "Ask administrator permission in compiler options!!!

Code: Select all

RunProgram("netsh"," int ip reset","",#PB_Program_Wait)
Delay(1000)
RunProgram("netsh"," winsock reset","",#PB_Program_Wait)
Delay(1000)
RunProgram("ipconfig"," /release","",#PB_Program_Wait)
Delay(1000)
RunProgram("ipconfig"," /renew","",#PB_Program_Wait)
Delay(1000)
RunProgram("ipconfig"," /flushdns","",#PB_Program_Wait)
Delay(1000)
;ipconfig /registerdns","",#PB_Program_Wait)
Delay(1000)
;NETSH winsock reset catalog","",#PB_Program_Wait)
Delay(1000)
RunProgram("NETSH"," int ipv4 reset reset.log","",#PB_Program_Wait)
Delay(1000)
RunProgram("NETSH"," int ipv6 reset reset.log","",#PB_Program_Wait)
Delay(1000)
MessageRequester("All restarted","please try your network again")
My source for those commands:
https://answers.microsoft.com/en-us/win ... 7f0445032a
Tested on my Win 11 and Win 7 machines - all good.
I named my compiled copy: RestartNetwork.exe
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Restart Windows Network

Post by Quin »

Nice, thanks for sharing! 8)
Might want to remove the delay calls around those commented out programs though, so it runs slightly faster :)
Randy Walker
Addict
Addict
Posts: 1058
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: Restart Windows Network

Post by Randy Walker »

Quin wrote: Sat Apr 05, 2025 12:32 am Nice, thanks for sharing! 8)
Might want to remove the delay calls around those commented out programs though, so it runs slightly faster :)
Yeah, I knew it would but wanted to leave room for the changes to take effect.
Could have also used the Hide option in RunProgram.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Axolotl
Addict
Addict
Posts: 832
Joined: Wed Dec 31, 2008 3:36 pm

Re: Restart Windows Network

Post by Axolotl »

I guess, that's one of the big advantages of open source everyone (programmers) can customize it to their liking .....
Thanks for sharing.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Randy Walker
Addict
Addict
Posts: 1058
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: Restart Windows Network

Post by Randy Walker »

Axolotl wrote: Sat Apr 05, 2025 11:15 am I guess, that's one of the big advantages of open source everyone (programmers) can customize it to their liking .....
Thanks for sharing.
I *never* claimed to be a programmer.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Restart Windows Network

Post by Quin »

Randy Walker wrote: Sat Apr 05, 2025 9:39 pm I *never* claimed to be a programmer.
Sorry to go slightly off topic here, but why do you so often say this? I'm asking out of true curiosity, to me it sounds like you've developed a pretty large piece of software that does what it needs to do well, and it has done so for years and years. What about that makes you not a programmer? You don't have to be an assembly wizard or able to type at 150 WPM or whatever else to be a programmer.
Randy Walker
Addict
Addict
Posts: 1058
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: Restart Windows Network

Post by Randy Walker »

Quin wrote: Sun Apr 06, 2025 2:17 am
Randy Walker wrote: Sat Apr 05, 2025 9:39 pm I *never* claimed to be a programmer.
Sorry to go slightly off topic here, but why do you so often say this?.
Actually I don't say it so often -- its in my signature in my PB forum membership profile, so it just happens to be at the bottom of all my posts.
In my mind a programmer is a professional -- someone who gets paid for their skills. None of that fits my profile. I am a hacker and sometimes mange to hack out something useful, but that doesn't make me a professional. That big program you referred to is the result of about 30 years of hacking to get the needed results. I think if I qualified as a professional, I would be able to figure out two major issues that have presented themselves over the last year or so. I just don't know the cause of the problems I have with my code. i can only attribute them to changes in the compilers. On several recommendations I have changed all my variable.l to variable.i but had no affect. If I were a programmer, my code would not be such a convoluted chain of incomprehensible gyrations i can't begin to sort out now.

Yes I'm a hacker according to the real definition:
hacker
A person who delights in having an intimate understanding of the
internal workings of a system, computers and computer networks in
particular. The term is often misused in a pejorative context,
where "cracker" would be the correct term. See also: cracker.
Ref: http://www.faqs.org/rfcs/rfc1392.html
Everyone in this forum is a hacker.

More accurately Nerium Dictionary defines hacker as:
1: one that hacks
Ref: https://www.merriam-webster.com/dictionary/hacker
I really hate that the term has been so badly abused.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Restart Windows Network

Post by Quin »

Likewise Randhy, I like to call myself a hacker in the oldest and best sense of the word. Sure, I did some things I probably shouldn't have with my computer knowledge when I was too young to understand how to use it properly, but I don't enjoy hacking government computers, I just enjoy ripping apart a piece of software and trying to figure out how its binary formats work or whatever. That's what makes hacking fun to me
Randy Walker
Addict
Addict
Posts: 1058
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: Restart Windows Network

Post by Randy Walker »

Quin wrote: Sun Apr 06, 2025 11:17 am Likewise Randy, I like to call myself a hacker in the oldest and best sense of the word. Sure, I did some things I probably shouldn't have with my computer knowledge when I was too young to understand how to use it properly
Yeah, not cool. I've always felt crackers should be hung on the street corner. Them and creators of anti-virus. I just don't think too highly of those who have no respect for other's property. I never tried to crack anything. I'm glad you wised up. BTW I see you are in Colorado. Anywhere near South Park, by chance? :wink:
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Post Reply