I have more than one adapter in my system and I want to know the IP of particular adapter. Is it possible through a command in Windows, in Linux it's easy? Or any other way?
Asked
Active
Viewed 3.4k times
14
-
1Invoking `ipconfig` doesn't seem much like programming (at least to me). – Jerry Coffin Dec 14 '10 at 14:19
3 Answers
32
The following will let you specify an adapter (something ipconfig doesn't appear to do):
netsh interface ip show config name="Local Area Connection"
You can add | findstr "IP Address" to the end of that command to only show the IP address line.
Trevor
- 48,482
- 2
- 16
- 12
-
Hey Trevor, I tried with "netsh interface ip show address" it gave me the actual current ip of my system but when i tried "netsh interface ip show address name="Local Area Connection" " it gave me some different ip which i used in past. One more thing what name i have to provide for getting the ip of PPP adapter can anyone suggest. – zombie Dec 14 '10 at 15:07
-
however it would show the ip address only if set as static, it does not show dhcp assigned IP. – Mubashar Nov 20 '13 at 00:37
-
And if you want to find out a name, you can use `netsh interface show interface` – Hrvoje T Mar 30 '18 at 06:54
0
Here's how I was able to get my IP Address for a specific network adapter:
for /f "tokens=3 delims=: " %i in ('netsh interface ip show config name^="Ethernet" ^| findstr "IP Address"') do echo Your IP Address is: %i
For an explanation of how this works, see my related answer here: https://stackoverflow.com/a/59004409/2684661
Joshua Dyck
- 1,885
- 18
- 23
-2
ipconfig /all should do the trick.
Chris Kooken
- 31,984
- 14
- 81
- 117
-
This doesn't answer the question. The OP wants to get a particular adapter and this will just list all of them out. – fujiiface Oct 03 '18 at 21:54