Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
:: Auto IP Updater
@echo off
ipconfig | find "IP Address" | find /v " 0.0.0.0">ip.tmp
FOR /f "tokens=2 delims=:" %%a in ('type ip.tmp') do SET IP=%%a
del /f ip.tmp
echo New %IP%>Ip.txt
type ip.txt | find "New" >> IPAddress.txt
Del Ip.txtok in the IPAddress.txt i have
Line 1
Line 2
Line 3
Line 4
Line 5wan i go on the .bat file it adds
Line 1
Line 2
Line 3
Line 4
Line 5
New 0.0.0.00.0.0.0 being my ip
if i keep going on the .bat file i get
Line 1
Line 2
Line 3
Line 4
Line 5
New 0.0.0.0
New 0.0.0.0
New 0.0.0.0
New 0.0.0.0i dont want it to keep adding a new line just to remove the last one and readd it with out removing
Line 1
Line 2
Line 3
Line 4
Line 5sorry for so much info ony way i can say it im doing this so wan i reboot it will auto add my ip in the .txt file for a project im working on wan i add it to auto run wan my pc loads thank you

Hi dap,
Once you've stripped out the old IP, just do this:
Save the file with no ip to noIP.txt, then:
@echo off
echo %IP% >> noIP.txt
copy noIP.txt IPAddress.txt
del noIP.txtM2

Hi dap,
I can probably help if you post the exact original file.
Use Dr. Nick's utility to 'keep it straught'.
http://students.cs.byu.edu/~drnick/entityrecode.html
M2

@echo off
ipconfig | find "IP Address" | find /v " 0.0.0.0">ip.tmp
FOR /f "tokens=2 delims=:" %%a in ('type ip.tmp') do SET IP=%%a
del /f ip.tmp
echo New %IP%>Ip.txt
type ip.txt | find "New" >> IPAddress.txt
Del Ip.txtand for the
Line 1
Line 2
Line 3
Line 4
Line 5i allready have tham added in the IPAddress.txt
wan u go on the .bat file it keeps readding the same info on a new line i
like it if it will remove the last line auto and than readd the ip at the end so ever time i reboot it will auto add it at the last line

i did its ony this
@echo off
ipconfig | find "IP Address" | find /v " 0.0.0.0">ip.tmp
FOR /f "tokens=2 delims=:" %%a in ('type ip.tmp') do SET IP=%%a
del /f ip.tmp
echo New %IP%>Ip.txt
type ip.txt | find "New" >> IPAddress.txt
Del Ip.txt

Try changing the last line of the bat file and see it this is what you want:
:: Auto IP Updater
@echo off
ipconfig | find "IP Address" | find /v " 0.0.0.0">ip.tmp
FOR /f "tokens=2 delims=:" %%a in ('type ip.tmp') do SET IP=%%a
del /f ip.tmp
echo New %IP%>Ip.txt
type ip.txt | find "New" >> IPAddress.txt
Del ipaddress.txt

ya thats helps it so it dont keep adding a new line with same info but say if u had allready info in the Ip.txt and want to keep it there with out removeing it all it still removes it
say we have this in Ip.txt allready
Line A
Line B
Line cand we go on the .bat file i want it to keep tham lines and add it at the end so all i want is to just add my ip at the end of the last line with out removeing A B C

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |