Batch file to reconnect Wi-Fi in Windows 10/11

This time, I would like to introduce a batch file that reconnects Wi-Fi.

Are you having trouble connecting to Wi-Fi when starting up Windows 10 or Windows 11, and even though it says "Connected," you can't connect to the Internet?

In this case, disconnecting from Wi-Fi and then reconnecting will usually allow you to connect normally.

table of contents

Batch file to restart Wi-Fi connection

What is a batch file? How to create and run a batch file

@echo off

sc stop WlanSvc

ping -n 5 127.0.0.1>nul

sc start WlanSvc

exit

1. Right-click on the saved batch file and click "Run as administrator."

2. When the "User Account Control" screen appears, click "Yes".

Command Description

CommandDescription
sc stop WlanSvcStop the WlanSvc service (WLAN AutoConfig).
ping -n 5 127.0.0.1>nulPause for 5 seconds.
sc start WlanSvcStart the WlanSvc service.

If you stop the WlanSvc service, the Wi-Fi will be disconnected.Task tray (notification area)The icon will change to a globe icon.

When you start the WlanSvc service, Wi-Fi will connect and the task tray icon will change back to its original icon.

If you found this article helpful, please share it on social media.

Person who wrote this article

Driven by questions arising from my daily PC use and the desire to "do more," I have been pursuing self-study in Windows since around 2008. I am sharing the "aha!" techniques and solutions I discovered through trial and error with the sole purpose of helping you in your PC life.

View profile

Comment:

To comment

[About submissions]
We welcome any questions or information regarding the content of the article.
However, please note that content unrelated to the purpose of the article, criticism of specific individuals or organizations, offensive language,Inappropriate wordsComments containing the above may be deleted or made private without notice at the discretion of the administrator.
Please note that spam may be automatically deleted by anti-spam measures.

CAPTCHA


table of contents