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

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

Image: iStock/Voren1

In the uphill battle to stay one step ahead of malicious criminals, Microsoft and other vendors are constantly updating, fixing, and refining network security protocols. For the most part, modern network interface connectors, the hardware responsible for establishing and maintaining your network connection, can handle these changes through software updates.

However, older network cards (usually Wi-Fi) in older or repurposed PCs and laptops can stop working for no apparent reason at the most inopportune moment. Whether during alternative school or an important team meeting, an Internet connection is the first prerequisite. If you have a problematic network connection that tends to fail periodically, you can create a simple batch file to reset the connection on the fly in seconds.

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

SEE: Research: How to successfully meet 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 tip. If you have a network card that fails periodically, 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, instead of this solution, you can create a simple batch file that disables the network connection and then immediately re-enables the connection. This process forces the network card to “reboot” and reset the network connection. If the described process fails to reset the connection, you may have other issues and further troubleshooting will be required.

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

Figure A

a-reset-nic-batch-file.jpg

Type this command in the command prompt and press Enter.

netsh interface show interface

The system will show you a list of network connections installed for your computer, like the one shown in Figure B. Write down the network connection name of the network adapter that is giving you trouble, 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 usually Notepad. Type “notepad” in the search field and select the app from the results.

Type the following commands in your text file:

@ECHO OFF

CL

netsh interface set interface PROBLEM disable

netsh interface set interface PROBLEM enable

pause

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

Figure C

c-reset-nic-batch-file.jpg

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

Quit Notepad when you have saved your batch file.

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

With echo disabled, you won’t see much happening, but your problematic network connection will have been disabled and then sequentially enabled, which resets the connection.

As mentioned earlier, if this does not restore a network connection, you may have other network issues to troubleshoot. Maybe your connection issues are related to your router or your ISP. These issues require a different set of commands and a different batch file, which we’ll explore in a separate article.

Also see