ip=specific or write to .log

September 12, 2010 at 14:43:58
Specs: Windows XP
I need a batch file that saves my ip in a text file if it´s not a specific adress.
This is what i have tested right now and it dosent work for me, i can a bat file to find my curent ip and save it but only allways

@echo off
ipconfig
if not "IP-adress"==IP-adress . . . . . . . . . . . . : 192.168.1.71
Find "IP-adress" > ip.txt

I have tested to exclude the dots in the ip and theres no difrence for me, the reason i used the dots is that it includes them if i get a bat file to show my current ip in a .txt


See More: ip=specific or write to .log

Report •


#1
September 12, 2010 at 14:53:20
ipconfig | find "IP Address" | find /v "192.168.1.71" >> ip.txt


Report •

#2
September 12, 2010 at 14:58:00
Try this:

@ECHO OFF

FOR /f "tokens=14 delims= " %%a IN ('IPCONFIG ^| FINDSTR IPv4') DO (
	SET Var=%%a
	GOTO List
)

:List

IF NOT "%Var%"=="192.168.1.71" ECHO %Var% >> IP.log
EXIT

EDIT: Razor beat me to the punch! Oh well. Whichever works best for you.

Can I put a question here?


Report •

#3
September 17, 2010 at 07:26:43
Thanks for the fast help ppl :D
It worked like a charm

Report •

Related Solutions


Ask Question