Share via

Enable/Disable Network interface via command line

Anonymous
2010-07-09T19:20:04+00:00

Hi guys,

Anybody here who could point me to a resource or a command line instruction to disable a network interface in Windows 7? Your help would be highly appreciated. Thanks in advance!

Em

Windows for home | Previous Windows versions | Devices and drivers

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

28 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-11-13T15:39:49+00:00

    You can use the following command to release the ip address of all the adapters. It will not disable any adapter, it will just disable the internet connectivity.

    ipconfig /release

    Re-enabling the internet

    ipconfig /renew

    Hope it helps...

    3 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-09-13T12:11:40+00:00

    Thanks EddieZA

    With your post I was able to create a batch file that I can use to enable/disable my LAN and Wireless adapters individually or simultaneously.

    The problem was that it had to be run with elevated privileges. So I created a shortcut to the batch file and used the "Run as administrator" option on the shortcut to run the batch file with the necessary elevated rights.

    If anyone else might appreciate having this utility here's the batch file I'm using now...

    @echo off

    cls

    goto Choices

    REM use this command to determine what the adapter index number is

    REM wmic nic get name, index

    :Top

    choice /c:123456

    If ERRORLEVEL == 6 goto Enable_Wireless_Disable_LAN

    If ERRORLEVEL == 5 goto Enable_LAN_Disable_Wireless

    If ERRORLEVEL == 4 goto Disable_Wireless

    If ERRORLEVEL == 3 goto Disable_LAN

    If ERRORLEVEL == 2 goto Enable_Wireless

    If ERRORLEVEL == 1 goto Enable_LAN

    goto EOF

    :1

    :Enable_LAN

    wmic path win32_networkadapter where index=9 call enable

    goto :EOF

    :2

    :Enable_Wireless

    wmic path win32_networkadapter where index=7 call enable

    goto :EOF

    :3

    :Disable_LAN

    wmic path win32_networkadapter where index=9 call disable

    goto :EOF

    :4

    :Disable_Wireless

    wmic path win32_networkadapter where index=7 call disable

    goto :EOF

    :5

    :Enable_LAN_Disable_Wireless

    wmic path win32_networkadapter where index=9 call enable

    goto :4

    :6

    :Enable_Wireless_Disable_LAN

    wmic path win32_networkadapter where index=7 call enable

    goto :3

    :Choices

    echo 1 Enable LAN

    echo 2 Enable Wireless

    echo 3 Disable LAN

    echo 4 Disable Wireless

    echo 5 Enable LAN / Disable Wireless

    echo 6 Enable Wireless / Disable LAN

    goto Top

    :EOF

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2013-04-25T17:48:58+00:00

    this does not work for me

    error of invalid method parameter

    the 7 has to have the slash below it?

    how do you get that

    3 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2013-06-08T18:39:11+00:00

    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

    This should work also with Windows 7 Home Premium 64bit, or only on 32bit versions?

    Thanks.

    2 people found this answer helpful.
    0 comments No comments