Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
OM3
- Posts: 32
- Joined: 17 Mar 2014 08:43
#1
Post
by OM3 » 17 Feb 2017 18:16
Has anyone got any DOS code to turn off and on the Ethernet adapter?
I googled and found this:
Code: Select all
Start elevated Command Prompt.
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
I'm not sure what elevated Command Prompt is?
Is the above code different to DOS?
Thanks
-
Compo
- Posts: 600
- Joined: 21 Mar 2014 08:50
#2
Post
by Compo » 18 Feb 2017 08:30
To Open an Elevated Command Prompt:
Right Click on
[Command Prompt] and choose
[Run as administrator]To Disable 'Enabled' Ethernet Adapters:
Code: Select all
WMIC Path Win32_NetworkAdapter Where "Not MACAddress Is NULL And NetEnabled=TRUE" Call Disable
To Enable 'Disabled' Ethernet Adapters:
Code: Select all
WMIC Path Win32_NetworkAdapter Where "Not MACAddress Is NULL And NetEnabled=FALSE" Call Enable