IP appending to text file. Possible ?
under win7 x64, is it possible to append the IP details that we get from
to a text file?
i tried -o switch as well as the "--append-output" , but it just refuse to append the information in a text file.
Does anyone know any other alternatives ?
i want to run batch command, probably scheduled to run every 6 hrs and so and want to record/log my IP to a text file, including timestamps.
how we can achieve this ?
Re: IP appending to text file. Possible ?
I believe wireshark does that, though I haven't used it thoroughly for quite a while.
Re: IP appending to text file. Possible ?
ipconfig /all >> textfile.txt
Sorry, just noticed you want to add a timestamp as well. For that you must create a batch file with the following contents:
Code:
@echo %date% %time%
@ipconfig /all
Save it somewhere (make sure the filename has a .bat extension), and then create a scheduled task for the following:
Code:
cmd /c "C:\Directory where\you put\the batch file.bat" >> "C:\IP log".txt
The double >-sign ensures text gets appended and not overwritten. Obviously, the paths must be replaced with your equivalents. If you want to log just your IP address without the extra info, add " | find "IPv4 Address" without the quotes and with the trailing space to the second line. We could fiddle with the first one as well...
Code:
@echo Today's %date%. The time is %time%. My IP address at the moment is as follows.
@ipconfig /all | find "IPv4 Address"
And that would give this more elegant output:
Quote:
Today's 14/06/2011. The time is 19:05:20,16. My IP address at the moment is as follows.
IPv4 Address. . . . . . . . . . . : 23.45.67.89(Preferred)
Re: IP appending to text file. Possible ?
Quote:
Originally Posted by
Cabalo
I believe wireshark does that, though I haven't used it thoroughly for quite a while.
Haven't digged much deeper but it seems it very advance tool.
Quote:
Originally Posted by
anon-sbi
Sorry, just noticed you want to add a timestamp as well. For that you must create a batch file with the following contents:
Code:
@echo %date% %time%
@ipconfig /all
Thanks you so much.
Code:
@echo Date:%date% Time:%time: =0% >> log.txt
@ipconfig /all | find "IPv4 Address" >> log.txt
serves what i was exactly wanted :cheers:
Re: IP appending to text file. Possible ?
Glad I could help!
Wireshark is a good tool, but unfortunately overkill for simple tasks, due to its amount of features. When I want to do simple packet sniffing, I just use SmartSniff.
Re: IP appending to text file. Possible ?
Btw does ipconfig show one's external IP if connecting through NAT on win7?
Re: IP appending to text file. Possible ?
Quote:
Originally Posted by
heiska
Btw does ipconfig show one's external IP if connecting through NAT on win7?
Nope, this is me running ipconfig behind my router:
Code:
IPv4 Address. . . . . . . . . . . : 192.168.1.100(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 127.0.0.1
NetBIOS over Tcpip. . . . . . . . : Disabled
You can however use curl icanhazip.com to obtain your WAN address, that site was created for these purposes.