Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 42,018 of 42,547    |
|    FromTheRafters to All    |
|    Re: Win10 network on/off toggle with adm    |
|    30 Mar 22 00:55:05    |
   
   From: erratic@nomail.afraid.org   
      
   USE MODEL:   
   a. Hit the taskbar shortcut (gwtoggle.lnk)   
   b. If the network was on, it (the gateway) will be turned off.   
    If the network was off, it (the gateway) will be turned on.   
    The Windows hardware icons will show the status accordingly.   
   c. If VPN was on, nothing will happen until the VPN drops.   
    If the VPN subsequently drops, the network (gateway) will be turned off.   
    The Windows hardware icons will show the status accordingly.   
      
   TASKBAR SHORTCUT:   
   gwtoggle.lnk   
    Target = C:\Windows\System32\schtasks.exe /run /TN "task gwtoggle"   
      
   SCHEDULED TASK:   
   taskschd.msc   
    task gwtoggle   
    Run with highest privileges = checked   
    Action = Start a program   
    Program/script = %comspec%   
    Add arguments = /c start "anything" c:\pathto\gwtoggle.bat   
      
   BATCH SCRIPT:   
   c:\pathto\gwtoggle.bat   
    @echo off   
    set defgw=192.168.1.1   
    set "ip="   
    for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where I   
   Enabled="True" get DefaultIPGateway /value | find "I" "') do if not defined ip   
   set ip=%%~a   
    IF "%ip%"=="%defgw%" ( %comspec% /c %windir%\system32\route.exe delete   
   0.0.0.0 %defgw%) ELSE ( %comspec% /c %windir%\system32\route.exe add 0.0.0.0   
   mask 0.0.0.0 %defgw%)   
    exit   
      
   SHORTCUT ICONS:   
   https://www.flaticon.com/free-icons/on-off   
   https://icons8.com/icons/set/on-off   
   https://iconarchive.com/tag/on-off   
      
   Example icon:   
   https://cdn.icon-icons.com/icons2/1535/PNG/512/3298613-onoff-swi   
   ch-switchoff-switchon_106998.png   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca