Deutsch   English   Français   Italiano  
<t20nbj$kr$1@gioia.aioe.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!aioe.org!QCiEG2yZwKrSNvfSDGS2fg.user.46.165.242.75.POSTED!not-for-mail
From: FromTheRafters <erratic@nomail.afraid.org>
Newsgroups: alt.comp.os.windows-10
Subject: Re: network on/off switch
Date: Tue, 29 Mar 2022 23:46:52 -0500
Organization: Peripheral Visions
Message-ID: <t20nbj$kr$1@gioia.aioe.org>
References: <t1m02k$opj$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="667"; posting-host="QCiEG2yZwKrSNvfSDGS2fg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-Newsreader: MesNews/1.08.06.00-gb
X-ICQ: 1701145376
Bytes: 1843
Lines: 21

Peter used his or her keyboard to write :

> Do you have a network on/off switch that can be double clicked to turn the 
> network off and then double clicked to turn the network back on?

nettoggle.lnk
 C:\Windows\System32\schtasks.exe /run /TN "task nettoggle"
                                                                                                                     ~                               
taskschd.msc
 task nettoggle 
 Run with highest privileges = checked
 Action = Start a program
 Program/script = %comspec%
 Add arguments = /c start "" c:\pathto\nettoggle.bat

nettoggle.bat
 @echo off
 set defgw=192.168.1.1
 set "ip="
 for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="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