Q. How do I find the IP address of the local computer in a logon script or other batch?

Jerold Schulman

July 27, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today

Using only built-in functionality, use the following line to set the ip environment variable:

for /f "skip=1 Tokens=2 Delims=[]" %%i in ('ping -n 1 %computername%') do set ip=%%i


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like