How to turn on WIFI via cmd?

20

5

My laptop's WiFi button is not working.
Is there any command in Windows to turn on WiFi ?

Sirwan Afifi

Posted 2014-01-02T21:40:15.583

Reputation: 1 462

2Sometimes the button is built in by the manufacturer and disconnects power to the WIFI via hardware and works without OS interaction, Other times it is just a windows notification button that relies on OEM software. If you can identify the laptop model it may be possible to tell if there is a software solution. – horatio – 2014-01-02T21:45:58.690

Answers

25

To do this using netsh:

Get the Interface Name:

netsh interface show interface

Enable the interface:

netsh interface set interface "Interface Name" enabled

To complete the solution to your problem, you could create a shortcut, and make it run on the startup of Windows. For example, if the name of your wireless adapter in netsh is Wi-Fi, the shortcut would look like this (one line):

C:\Windows\System32\runas.exe /savecred /user:administrator "C:\Windows\System32\netsh.exe interface set interface \"Wi-Fi\" enabled"

The runas command ensures that the command is ran as administrator, which is required to bring the interface up or down. The /savecred switch will save the credentials, which might be asked the first time, but usually not after that.

Timothy

Posted 2014-01-02T21:40:15.583

Reputation: 533

1I'm getting "This network connection does not exist" – CodyBugstein – 2016-07-11T22:00:43.230

Hi @CodyBugstein make sure that you write the Interface Name using the correct case. This is one of the gotchas...hope it helps – Ezra A.Mosomi – 2017-01-04T05:04:32.730

The runas command doesn't help because you don't get read admin permissions. – dan1st – 2019-10-09T13:16:20.650

6

Get NIC list and index number:

wmic nic get name, index

Enable NIC with index number: (eg: 7)

wmic path win32_networkadapter where index=7 call enable

Disable NIC with index number: (eg: 7)

wmic path win32_networkadapter where index=7 call disable

abzcoding

Posted 2014-01-02T21:40:15.583

Reputation: 231

2

The above strongly suggests to have come from this link verbatim - please next time cite your sources: https://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/enabledisable-network-interface-via-command-line/17a21634-c5dd-4038-bc0a-d739209f5081

– dyslexicanaboko – 2017-01-18T17:03:09.327

In one line of code. For a batch file use %% - WMIC PATH Win32_NetworkAdapter WHERE "Name LIKE '%%Wireless%%'" CALL enable . For typing in the console - WMIC PATH Win32_NetworkAdapter WHERE "Name LIKE '%Wireless%'" CALL enable – it3xl – 2018-03-24T11:24:40.133

1

You could use DevCon to disable the device from the commandline. Think of DevCon.exe as a commandline device manager, but that would just turn the adaptor on and off.

You're prolly better off using netsh commands.

MDT Guy

Posted 2014-01-02T21:40:15.583

Reputation: 3 683

Here's more about devcon: https://rickosborne.org/blog/2007/02/stupid-windows-tricks-restart-network-adapter-when-it-hangs/

– ArtemGr – 2015-08-06T21:49:31.850