Turn Off LAC Via Batch File


  1. Posts : 6
    Windows 10 Enterprise x64 20H2 Build 19042.804
       #1

    Turn Off LAC Via Batch File


    Windows 10 1909 (18363.720)

    Back in my Windows 7 days, I created a batch file, that watched for the unexpected/accidental disconnection of my VPN, and
    immediately killed my main Ethernet connection.

    Worked flawlessly, saved me a number of times.

    Well now I am in Windows 10. Batch file almost works fine in 10, except for the line that kills my main connection.

    Back in "7", my main Ethernet connection was called, "Local Area Connection 1", and my VPN was, "Local Area Connection 2".

    Now in 10, my main is simply called, "Ethernet", and my VPN is called, "Local Area Connection".

    So, I made the "name" adjustments to my batch file, but, it no longer kills my main, when the VPN drops.

    Here is the line, from my batch file, that used to kill my main in "7", but does not kill it in "10". Keep in
    mind that I have updated the main name from the old, "Local Area Connection 1", to "Ethernet" now:

    netsh interface set interface "Ethernet" DISABLE

    What is the proper way to drop my main in "10" via batch file?
      My Computer

  2. Try3's Avatar
    Posts : 7,517
    Windows 10 Home x64 Version 20H2 Build 19042.928
       #2

    The syntax is
    Code:
    netsh interface set interface name="Ethernet" admin=DISABLED
    but I am still successfully using this [Windows 7] variation for reasons that I do not understand {this is similar to the old syntax that you have been trying to use but you wrote disable instead of disabled}
    Code:
    netsh interface set interface "Ethernet" disabled

    You can get the syntax by entering
    Code:
    netsh interface set interface /?
    or, using your own folder path & filename,
    Code:
    netsh interface set interface /? >D:\Desktop\NetshInterfaceSetInterface.txt

    Do note that online guides purporting to explain the whole set of netsh commands normally use non-Windows 10 versions of netsh [older versions or server versions]. So you are stuck with investigating the syntax yourself for all new uses. I have not managed to find a single online source that conforms to the Windows 10 version of this utility.

    Denis
      My Computer

  3. TairikuOkami's Avatar
    Posts : 4,693
    Windows Home Dev 21xxx x64
       #3
      My Computer


  4. Posts : 6
    Windows 10 Enterprise x64 20H2 Build 19042.804
    Thread Starter
       #4

    I want to thank both of you, Try3 and TairikuOkami, for the wealth of information you have supplied me.

    It turns out, I simply need to run the batch file As Admin, and then it works perfect.

    Thanks again.
    Last edited by BoSven; 21 Mar 2020 at 14:18.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 18:12.
Find Us




Windows 10 Forums