Computing.Net > Forums > Windows 2000 > Auto IP Updater for .txt file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Auto IP Updater for .txt file

Reply to Message Icon

Name: Dap
Date: March 17, 2005 at 17:31:06 Pacific
OS: win 2000 pro
CPU/Ram: p4 3.0 / 512 ddr ram
Comment:

:: 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.txt

ok in the IPAddress.txt i have

Line 1
Line 2
Line 3
Line 4
Line 5

wan i go on the .bat file it adds

Line 1
Line 2
Line 3
Line 4
Line 5
New 0.0.0.0

0.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.0

i 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 5

sorry 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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: March 17, 2005 at 19:37:10 Pacific
Reply:

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.txt

M2


0

Response Number 2
Name: Dap
Date: March 17, 2005 at 20:51:39 Pacific
Reply:

it keeps remove all the lines im traying just to remove the last line and keep the lines i got


0

Response Number 3
Name: Mechanix2Go
Date: March 17, 2005 at 21:01:44 Pacific
Reply:

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


0

Response Number 4
Name: Dap
Date: March 17, 2005 at 21:11:02 Pacific
Reply:

@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

and for the

Line 1
Line 2
Line 3
Line 4
Line 5

i 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


0

Response Number 5
Name: Mechanix2Go
Date: March 17, 2005 at 21:20:51 Pacific
Reply:

Hi dap,

I mean the real file.

Not this:

Line 1
Line 2
Line 3
Line 4
Line 5

M2


0

Related Posts

See More



Response Number 6
Name: Dap
Date: March 17, 2005 at 21:24:57 Pacific
Reply:

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


0

Response Number 7
Name: Mechanix2Go
Date: March 17, 2005 at 21:31:56 Pacific
Reply:

I'm lost.

M2


0

Response Number 8
Name: landon
Date: March 18, 2005 at 07:51:21 Pacific
Reply:

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


0

Response Number 9
Name: Dap
Date: March 18, 2005 at 16:35:20 Pacific
Reply:

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 c

and 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



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: Auto IP Updater for .txt file

how to remove a line in a .txt file www.computing.net/answers/windows-2000/how-to-remove-a-line-in-a-txt-file/61645.html

help, no file association for exe files www.computing.net/answers/windows-2000/help-no-file-association-for-exe-files-/33054.html

batch for open files www.computing.net/answers/windows-2000/batch-for-open-files/42477.html