windowsmacoswindows-10ip-address

How to get and store the localhost ip address into a variable (Windows 10)


In MacOs I used the below command to get the machine local ip address

echo $(/usr/sbin/ipconfig getifaddr en0)

I can also set this IP address into a variable like this as well

export DISPLAY=$(/usr/sbin/ipconfig getifaddr en0)

Similarly like the above how can I get and set the ip address of Windows 10. If I execute ipconfig it prints many things but I need only the local ip address


Solution

  • To find your IP address on Windows 10, using the command prompt, you can use the following command, ipconfig /all and press Enter. Your IP Address will display along with other LAN details.