Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #180179

Re: {rightclick} New | Text Document

From Wolf Greenblatt <wolf@greenblatt.net>
Newsgroups alt.comp.os.windows-10, alt.comp.os.windows-11
Subject Re: {rightclick} New | Text Document
Date 2024-11-25 17:50 -0500
Organization Private News Server
Message-ID <vi2v01$e6n8$1@news.samoylyk.net> (permalink)
References (2 earlier) <vgkgt0$34b07$1@dont-email.me> <vgl6cs$1kf7$1@news.samoylyk.net> <vgltr1$3brmr$1@dont-email.me> <vgmnip$5uia$1@news.samoylyk.net> <vgnujl$3p1tp$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


On Sat, 9 Nov 2024 10:20:21 -0500, Zaidy036 wrote:

>> Most of my stuff is written by you & others like Zaidy03 <Eric@Bloch.com>.
> 
> Thanks for the mention.
> If I was doing something similar I would use one batch and its first 
> step would be to ask how many (0-9) , kill batch if 0 otherwise use the 
> number to do what I want. Why have multiple batches when one will work 
> and take less file space? The make a shortcut to start the batch and 
> perhaps also a "Shortcut Key" which would give efficient activation.+

Thanks for noticing. I keep in my REM comments the name of the person 
who helped as I've tried at least once probably every script posted 
to this ng.

Thanks for contributing to the newsgroup so we can find your stuff 
when we search the archives for your name and some related batch 
keyword!

This one, for example, is by you based on the comments in the file.

 @echo off
 REM nettoggle.bat by Zaidy036 20210207 on alt.comp.os.windows-10
 REM Win10 network on/off toggle with admin privileges, Feb 7, 2021
 REM https://groups.google.com/g/alt.msdos.batch/c/sDNRLfXlUHo
 REM With an attempt to get admin privileges programmatically
 REM https://stackoverflow.com/questions/22367173/get-default-gateway-from-batch-file
 REM for /f "tokens=1-5" %%a in ('route -4 print 0.*') do @if "%%e"=="" if "%%a"=="%%b" set "ip=%%c"

 :: Verify permissions
 >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
 
 :: On Error No Admin
 if '%errorlevel%' NEQ '0' (
     echo Getting administrative privileges...
     goto DoUAC
 ) else ( goto getAdmin )
 
 :DoUAC
     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
     set params = %*:"=""
     echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
 
     "%temp%\getadmin.vbs"
     del "%temp%\getadmin.vbs"
     exit /B
 
 :getAdmin
     pushd "%CD%"
     CD /D "%~dp0"
 REM 
 set defgw=192.168.0.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

Back to alt.comp.os.windows-10 | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

{rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-15 08:47 -0400
  Re: {rightclick} New | Text Document Big Al <alan@invalid.com> - 2024-10-15 09:53 -0400
  Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-15 16:43 +0200
    Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-15 13:04 -0400
      Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-16 00:44 +0200
        Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-16 01:49 +0200
          Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-15 23:12 -0400
            Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-16 09:44 +0200
              Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-16 16:31 -0400
            Re: {rightclick} New | Text Document Newyana2 <newyana@invalid.nospam> - 2024-10-16 08:52 -0400
  Re: {rightclick} New | Text Document Newyana2 <newyana@invalid.nospam> - 2024-10-15 11:26 -0400
  Re: {rightclick} New | Text Document Paul <nospam@needed.invalid> - 2024-10-15 13:38 -0400
  Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-07 22:42 -0500
    Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 09:07 +0100
      Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 09:14 -0500
        Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 17:18 +0100
          Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 13:58 -0500
            Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 22:18 +0100
              Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 20:24 -0500
                Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-09 10:22 +0100
        Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 17:30 +0100
        Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-08 21:53 +0100
          Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 23:14 -0500
            Re: {rightclick} New | Text Document Zaidy036 <Zaidy036@air.isp.spam> - 2024-11-09 10:20 -0500
              Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-25 17:50 -0500
            Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:35 +0100
            Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:36 +0100
            Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:37 +0100
            Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:38 +0100
            Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-25 18:04 -0500

csiph-web