Link to home
Start Free TrialLog in
Avatar of slayer199
slayer199Flag for United States of America

asked on

Find Local IP in batch file

This is the only section of the script that doesn't work.  It does pull the IP, but it outputs the IP with a leading space which kills the rest of my script.

Ex.
 192.168.1.100
When it needs to be
192.168.1.100

What am I doing wrong here?  The rest of my script works well.
::discover the local IP
:LOCALIP
for /f "tokens=2* delims=:" %%a in ('ipconfig ^| find "IP Address"') do set LOCALIP=%%a
echo %localip%

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slayer199

ASKER

That works...thanks much!