home bbs files messages ]

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,395 of 42,547   
   JJ to Andrew   
   Re: Does Windows 11 have any tricks to m   
   26 Aug 24 12:59:33   
   
   XPost: alt.comp.os.windows-10, alt.comp.os.windows-11, alt.comp.   
   icrosoft.windows   
   From: jj4public@outlook.com   
      
   On Sun, 25 Aug 2024 21:37:45 -0000 (UTC), Andrew wrote:   
   >   
   > In summary, the main "trick" that I need help on is how to tell for sure   
   > that I've connected to a VPN server - where there are two ways that I know   
   > of offhand, one of which is the VPN log file will say this as the last line   
   >  "Initialization Sequence Completed"   
   >   
   > The other way is that a curl command will show a different IP address.   
   >   
   >  Win+R whatismyipaddress [return]   
   >  Which is a keyword of that same name (i.e., whatismyipaddress.exe) in   
   >  HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\what   
   smyipaddress.exe   
   >  Which executes the shortcut C:\pathto\whatismyipaddress.lnk   
   >  Whose target is %comspec% /k echo "C:\pathto\whatismyipaddress.lnk   
   %myipaddress%" & %Windir%\System32\curl.exe ifconfig.me   
   >   
   > This will report the known static ISP IP address plus the current IP   
   > address, where I don't know yet how to compare them in a batch file.   
   >   
   > Hence, the two "tricks" of the trade I would like to ask for help on how to   
   > do are (a) how do I compare two IP addresses, and (b) how do I test whether   
   > or not the VPN connection has been established?   
   >   
   > Any ideas from anyone out there on those two Windows networking tricks?   
      
   It's best to use a batch file for that. Otherwise everything will have to be   
   placed in one very long command line. It'd be a pain to maintain and update.   
      
   The output of that curl accessing ifconfig.me is already just the IP   
   address, so it can simply be retrieved as is and placed into a variable.   
   e.g. in a batch file:   
      
   @echo off   
   setlocal   
   for /f "delims=" %%A in ('%Windir%\System32\curl.exe ifconfig.me') do set   
   ipcurl=%%A   
   echo IP from curl = %ipcurl%"   
      
   The output of whatismyipaddress.exe however, I don't know. I'm not familiar   
   with that program, and Googling that exact file name gives no match. If its   
   output is not just an IP address, then the batch file will need to parse the   
   output and extract oly the IP address. I can't know how exactly to do that,   
   since I don't know its exact output. If it's just an IP address, then you   
   can use the same method as above except with different variable name. Then   
   you can compare both variable like you did on your other batch file.   
      
   --- 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