This article shows how to disable/enable Wireless network connection(WiFi) on a windows system from command line. We can also find the status of network connections, check if they are connected or disconnected.
Disable WiFi from command prompt
Open elevated administrator command prompt and run the below command to turn off WiFi
netsh interface set interface name="Wireless Network Connection" admin=DISABLED
After running the command, you can immediately see in System tray (Right bottom corner on your windows screen) that WiFi is disconnected. In network connections, it shows it as disabled.
How to enable WiFi connection
Run the below netsh command to turn on Wifi connection from command line.
netsh interface set interface name="Wireless Network Connection" admin=ENABLED
How to disconnect Wifi connection
If you don’t want to disable WiFi interface on your computer, but only disconnect from a specific WiFi network, then run the below command.
netsh wlan disconnect
This does not turn off Wifi interface on the computer.
Connect to Wifi network from CMD
Run the below command to connect to a specifi WiFi network
netsh wlan connect name="WifiNetWorkName"
Errors
This command needs to be run from elevated command prompt to make any changes to the network connection configuration. Running from normal command prompt throws up error as below.
C:\>netsh interface set interface name="Wireless Network Connection" admin=DISABLED An interface with this name is not registered with the router.
There’s an error in the wording here. It says at one point “elevator command prompt” ironically in the errors section. Shouldn’t this be “elevated command prompt”?
Thanks for pointing it out. Corrected the typo.
I copied and pasted the first expression and pressed enter and the it comes up as “No more data is available”
you need to run cmd as administrator it happened to me too
Is there a way to disable connecton to ONE specific (open)Wifi network, but not affect connection to any other (private)network ? ( W7/64)
is it possible to kick someone in my wifi connection using cmd?
thanks you
netsh interface set interface name, wasnt working for me after going thru multiplie sites
your way netsh wlan works!
how to connect a wifi network which is having password through windows command line?
I am exploring a way to write powershell(or any other scripting language) script to disconnect all the connected devices to my windows mobile hotspot.
Could you guide on how to do it?