Enable/disable wireless interface in a bat file
Following works on Win 7 from a cmd
prompt with admin
privileges:
To Disable:
netsh interface set interface "Wireless Network Connection" Disable
To Enable:
netsh interface set interface "Wireless Network Connection" Enable
To get the interface names:
C:\Users\nirmal>netsh interface show interface
Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Connected Dedicated Wireless Network Connection
Disabled Disconnected Dedicated Local Area Connection
I'd like to set up a bat file or a shortcut that I can use to enable/disable the wireless
Use Microsoft DevCon ...
The DevCon utility is a command-line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon also provides information that is relevant to the driver developer and is not available in Device Manager.
And here's tutorial for you:
Enable/Disable Wireless Card from Command Line
preferably a single one that toggles the current state
You'll need two batch files, one for WiFi Off and one for WiFi On.
Having said that, i assume you're using a laptop. Are you sure your Laptop doesn't allow to toggle WLAN on/off via a Fn key combo or a physical switch? Can you post make and model?
FYI ... for 64bit version of vista and Win7 the "64bit" version noted above will not work. You have to download the entire windows device driver kit, then extract devcon.exe from here:
C:\WinDDK\7600.16385.1\tools\devcon\amd64\devcon.exe
and paste into c:\Windows/system23
(I know, I know ... I also have an Intel i3 and still had to use this "amd64" one)
The WinDDK kit can be found here: http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx It's huge (620 MB). The devcon file is tiny. :p
Note: An easy way to find the device driver number for any device by going into device manager (from control panel), look at the properties, and under "details" select "Hardware IDs". There will be a big number, you just want this part: DEV_???? (fill in the ? with your 4 numbers). For example if it's DEV_4315
then put this in enable.bat: devcon enable
"*DEV_4315", and put this in disable.bat: devcon disable
"*DEV_4315".
Please make sure and add the wildcard preceding it: *DEV_???? (see the 2 examples I just gave). You'll need to run them as administrator. FYI ... if you have a hardware indicator light then this will probably not toggle it.