Home TechnologyWindows How to reset a network connection in Windows 10 with a batch file

How to reset a network connection in Windows 10 with a batch file

How to reset a network connection in Windows 10 with a batch file

Network connections in older or repurposed PCs may stop working for no apparent reason. Users can overcome this frustrating situation by running a simple batch file.

Hamster chewed network cables

Image: iStock/Voren1

In the relentless battle to stay ahead of criminals with malicious intent, Microsoft and other vendors constantly update, repair and refine network security protocols. For the most part, modern network interface connectors, the hardware that is responsible for establishing and maintaining your network connection, can handle these changes through software updates.

Older NICs (typically Wi-Fi) in older or repurposed PCs and laptops, however, may stop working for no apparent reason at the most inopportune time. Whether it is during alternative schooling or an important team meeting, an internet network connection is the primary prerequisite. If you have a troublesome network connection that tends to fail periodically, you can create a simple batch file to reset the connection on the fly in seconds.

This how-to tutorial explains how to create a batch file in Windows 10 that will reset a network connection.

SEE: Research: How to successfully navigate the technical and management challenges of a remote workforce (TechRepublic Premium)

How to reset a network connection in Windows 10 with a batch file

First, a word of advice. If you have a NIC that periodically fails, for whatever reason, you should consider purchasing a replacement. USB network interfaces are available for around $25. It’s a small price to pay for relief from what can be a frustrating experience.

However, in lieu of that solution, you can create a simple batch file that disables the network connection and then immediately enables the connection again. That process forces the NIC to “reboot” and reset the network connection. If the described process fails to reset the connection, you may have other issues and more troubleshooting will be required.

Before we start the batch file, we first need to gather a bit of vital information. Open a command prompt by using the keyboard combination Windows Key + R and typing “cmd” into the textbox, as shown in Figure A.

Figure A

a-reset-nic-batch-file.jpg

Type this command into the command prompt and press Enter.

netsh interface show interface

The system will show you a list of installed network connections for your computer, like the one shown in Figure B. Note the network connection name of the NIC that is causing you trouble, and then close the command prompt window.

Figure B

b-reset-nic-batch-file.jpg

Now create the batch file. Start your favorite text editor, which for Windows 10 users is typically Notepad. Type “notepad” into the search box and select the app from the results.

Type the following commands into your text file:

@ECHO OFF

cls

netsh interface set interface PROBLEM disable

netsh interface set interface PROBLEM enable

pause

Your text file should look something like Figure C. NOTE: Change “PROBLEM” to the name of your problem connection (Wi-Fi, Ethernet 2, etc.).

Figure C

c-reset-nic-batch-file.jpg

In Notepad, click File | Save As, elect All file types, and choose the Desktop folder as the location, and then give the file a descriptive name. Just remember to use the “.bat” file type. For our example, we named the file ResetNIC.bat.

Exit out of Notepad when you have saved your batch file.

You will have to run the batch file with administrative credentials each time. So instead of left-clicking the batch file, right-click it and select Run As Administrator from the context menu.

With echo off, you will not see much happening, but your problem network connection will have been disabled and then enabled sequentially, which resets the connection.

As mentioned before, if this does not reestablish a network connection, you may have other network problems to troubleshoot. Perhaps your connection problems are related to your router or your ISP. Those problems require a different set of commands and a different batch file, which we will explore in a separate article.

Also see

This article is auto-generated by Algorithm Source: www.techrepublic.com

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
Read Comments

Related Posts

0

Ad Blocker Detected!

Refresh