Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
emos
- Posts: 2
- Joined: 29 Jan 2018 15:23
#1
Post
by emos » 10 Apr 2019 11:34
Hi,
I'm trying to put to gather a script that search for a specific Network Adapter Name. But what ever i do only my Wireless card is the only adapter name i can get going.
I'm i using "find" incorrect?
Code: Select all
@echo off
for /f "skip=3 tokens=1,2,3* delims= " %%a in ('netsh interface show interface ^|find /v "Ethernet"') do Set AdapterName=%%d
if %AdapterName%=="Ethernet" (GOTO BEGIN) Else (GOTO SELECT_NIC)
:%%a = Status
:%%b = Connection status
:%%c = Type?
:%%d = Interface name
:BEGIN
echo You made it
:SELECT_NIC
echo **ERROR**
echo Could not find adapter name
echo.
echo %AdapterName%
pause
-Evan
-
jfl
- Posts: 226
- Joined: 26 Oct 2012 06:40
- Location: Saint Hilaire du Touvet, France
-
Contact:
#3
Post
by jfl » 11 Apr 2019 06:24
I have a script that does just that:
ipcfg.bat, part of my
System Tools Library
ipcfg.bat has lots of options. But the idea is to select only "interesting" network information.
By default, it outputs just the information for the active NICs, as you're trying to do.
Examples:
Code: Select all
C:\JFL\Temp>ipcfg -l
Ethernet 2
Ethernet 5
LAN
Local Area Connection* 5
Local Area Connection* 7
VirtualBox Host-Only Network
Wi-Fi
C:\JFL\Temp>ipcfg LAN
Connection-specific DNS Suffix . : emea.hpqcorp.net
Link-local IPv6 Address . . . . . : fe80::4dc9:e55f:cc0a:950e%7
IPv4 Address. . . . . . . . . . . : 10.38.145.38
Subnet Mask . . . . . . . . . . . : 255.255.252.0
Default Gateway . . . . . . . . . : 10.38.144.1
C:\JFL\Temp>