get ip for batch commands

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
vandel212
Posts: 1
Joined: 15 Oct 2009 14:02

get ip for batch commands

#1 Post by vandel212 » 15 Oct 2009 14:05

I was wondering if it were possible to ping the current ip address of the computer. The reason I would like to do this is because it is constantly changing on my network and I would just like to ping the current address instead of changing it every time.

Thanks in advance.

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 15 Oct 2009 15:56

You can use the ip 127.0.0.1


Otherwise you can use some manipulations with for to get the IP address from ipconfig.

gianniiiii
Posts: 5
Joined: 15 Oct 2009 05:00

#3 Post by gianniiiii » 16 Oct 2009 03:57

avery_larry wrote:You can use the ip 127.0.0.1


Otherwise you can use some manipulations with for to get the IP address from ipconfig.


i use this,

IPCONFIG |FIND "IP" > %temp%\TEMPIP.txt
FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a
del %temp%\TEMPIP.txt

jaffamuffin
Posts: 40
Joined: 25 Jan 2008 14:05

#4 Post by jaffamuffin » 16 Oct 2009 12:35

FOR /F "tokens=2 delims=:" %%a in ('IPCONFIG ^|FIND "IP"') DO ECHO %%a

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#5 Post by avery_larry » 16 Oct 2009 18:44

Great until you have multiple adapters.

gianniiiii
Posts: 5
Joined: 15 Oct 2009 05:00

#6 Post by gianniiiii » 19 Oct 2009 02:57

@Jaffamuffin

also ifmaybe it's better to open a new Topic, i can't found resource about the character "^"

is there a topic here?

gianniiiii
Posts: 5
Joined: 15 Oct 2009 05:00

#7 Post by gianniiiii » 19 Oct 2009 03:21


Post Reply