Windows 10: Turn Off LAC Via Batch File

Discus and support Turn Off LAC Via Batch File in Windows 10 Network and Sharing to solve the problem; 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... Discussion in 'Windows 10 Network and Sharing' started by BoSven, Mar 21, 2020.

  1. BoSven Win User

    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?

    :)
     
    BoSven, Mar 21, 2020
    #1
  2. oily_17 Win User

    Batch Files Knowledge Base

    Don't use batch files very much but one I find useful is for creating a list of files in a directory.
    Just copy the text below into Notepad and save as Filelist.bat

    dir /a /-p /o:gen >filelist.txt

    When you run it from a folder it will create a Filelist.txt file,in the same folder, that lists all the files in that folder.Useful when you are too lazy to type all the files out yourself.
     
    oily_17, Mar 21, 2020
    #2
  3. Batch Files Knowledge Base

    Very nice and usefull thanks for contributing.
     
    AphexDreamer, Mar 21, 2020
    #3
  4. Steevo Win User

    Turn Off LAC Via Batch File

    Batch file to ping network

    No, batch files are extremely easy.

    A "If" requires three extra steps.

    Code is not how much you can put in, but how lite can you make it and still perform the functions.

    So

    @ echo off


    ping 1.4.1.4 >a.txt

    findstr /m "Request timed out" a.txt
    if %errorlevel%%==0 (
    echo Save our nets!!!
    )

    pause
     
    Steevo, Mar 21, 2020
    #4
Thema:

Turn Off LAC Via Batch File

Loading...
  1. Turn Off LAC Via Batch File - Similar Threads - Turn Off LAC

  2. Screen switching via batch/powershell file possible?

    in Windows 10 Gaming
    Screen switching via batch/powershell file possible?: Hi, I have three screens connected to my PC, 1 x TV and 2 x TFT's.I'd like to be able to automatically switch between different screens as being primary whilst disabling the others via double click on, perhaps, a batch file.Essentially I would like to be able to have three...
  3. Screen switching via batch/powershell file possible?

    in Windows 10 Software and Apps
    Screen switching via batch/powershell file possible?: Hi, I have three screens connected to my PC, 1 x TV and 2 x TFT's.I'd like to be able to automatically switch between different screens as being primary whilst disabling the others via double click on, perhaps, a batch file.Essentially I would like to be able to have three...
  4. Batch Files

    in Windows 10 Software and Apps
    Batch Files: How do i make it that my batch file puts itself in to startup https://answers.microsoft.com/en-us/windows/forum/all/batch-files/6156404d-20d4-4f58-bee5-14629dbf7b10
  5. Create batch files with Batch?

    in Windows 10 Software and Apps
    Create batch files with Batch?: How to create Batch and VBS files with Batch? So I write a batch file which I then convert to exe that creates new folders in a certain directory and then creates batch and VBS files with a certain content and saves them in the created folder. So it's similar to a program...
  6. Turn Off the Display Via the Power Button

    in Windows 10 BSOD Crashes and Debugging
    Turn Off the Display Via the Power Button: I would like to turn off the display on my tablet without putting it to sleep via pressing the power button. I read that the Power Options allow this. But, when I looked, I saw only Do nothing, Sleep, Hibernate, and Shut down. Turn off the display is not available. What...
  7. Is there a way to change wallpaper via cmd/batch file?

    in Windows 10 Ask Insider
    Is there a way to change wallpaper via cmd/batch file?: We're doing a ton of Windows 7 upgrades to Windows 10 (clean installs, not in-place upgrades) and we have a batch file that runs a bunch of stuff as part of the new PC deployment process. Someone else wrote the batch a while back and I'm just trying to improve it a bit. I'd...
  8. Update Screensaver via batch file

    in Windows 10 Customization
    Update Screensaver via batch file: Ok ... Just found this forum couple weeks ago and was able to get some bang up batch file stuff. So ... figure I'd join. Especially, since my last piece of information retrieved from here isn't working. Ok ... this is for my computer and personal use only so the advice...
  9. Start Batch File Minimized via Task Scheduler

    in Windows 10 Support
    Start Batch File Minimized via Task Scheduler: I have a batch file scheduled to run in Task Scheduler in Windows 10. The batch file runs on schedule, but it opens a full CMD window. I have tried entering variations on start /min in the Task Scheduler properties, but these seem to have no effect. The particular batch...
  10. OneDrive Batch Upload - Turn On or Off in Windows 10

    in Windows 10 Tutorials
    OneDrive Batch Upload - Turn On or Off in Windows 10: How to: OneDrive Batch Upload - Turn On or Off in Windows 10 How to Turn On or Off OneDrive Uploading Files in Batches in Windows 10 [img] Information OneDrive is a cloud-based storage service where you can view, browse, upload, and share the files you saved online...