Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,095 of 68,980    |
|    JJ to Petr Laznovsky    |
|    Re: how to detect the network interface     |
|    16 Dec 17 17:33:45    |
   
   From: jj4public@vfemail.net   
      
   On Fri, 15 Dec 2017 15:00:58 +0100, Petr Laznovsky wrote:   
      
   > My USB network adapter (newest drivers) is not presented in system after   
   computer wake-up from   
   > sleep. Few persons working on this machine, including changing IP addresses   
   (due to attaching and   
   > working with various network devices).   
   >   
   > When I go to computer, wake it up and want to start working immediatelly,   
   but now I need to reset   
   > (enable && disable) interface, check ip networks and possibly add some if   
   missing. This is boring so   
   > I construct script which reset interface and add required addresses if   
   missing.   
   >   
   > Problem is the interface need some time to "initialization" (add all static   
   defined networks) so I   
   > insert timeout command, but this time could vary by cpu load and I want to   
   check if interface is   
   > already "initilizated" programatically, but have no idea how.   
   >   
   > Second problem is the checking if IP network is already listed or should be   
   added does not working.   
   >   
   > Any ideas? L.   
   >   
   > set "__net1=netsh in ip add address ETH1 192.168.0.100 255.255.255.0"   
   > set "__net2=netsh in ip add address ETH1 192.168.1.100 255.255.255.0"   
   > set "__net3=netsh in ip add address ETH1 192.168.2.100 255.255.255.0"   
   > set "__net4=netsh in ip add address ETH1 192.168.2.100 255.255.255.0"   
   > set "__net5=netsh in ip add address ETH1 192.168.168.100 255.255.255.0"   
   > devcon disable "USB\VID_9710&PID_7830" >NUL   
   > devcon enable "USB\VID_9710&PID_7830" >NUL   
   >   
   > timeout /T 6 /NOBREAK   
   >   
   > @echo off & setlocal ENABLEDELAYEDEXPANSION   
   > for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /C:"IPv4   
   Address"') do (   
   > set "string="   
   > for /f "tokens=2 delims==" %%A in ('set __net') do (   
   > echo %%~A| findstr "%%~a">NUL   
   > if not errorlevel 1 set "string=%%~A"   
   > )   
   > if not "!string!"=="" !string!   
   > )   
      
   IMO, the program load time for NETSH is pretty high. I'd suggest using PING   
   instead.   
      
   --- 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