Petr Laznovsky
unread,Dec 15, 2017, 9:01:03 AM12/15/17You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
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!
)