View Full Version : IP appending to text file. Possible ?
Evelyn
06-14-2011, 09:22 PM
under win7 x64, is it possible to append the IP details that we get from
ipconfig /all 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 ?
Cabalo
06-14-2011, 09:39 PM
I believe wireshark does that, though I haven't used it thoroughly for quite a while.
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:
@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:
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...
@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:
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)
Evelyn
06-15-2011, 02:15 PM
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.
Sorry, just noticed you want to add a timestamp as well. For that you must create a batch file with the following contents:
@echo %date% %time%
@ipconfig /all
Thanks you so much.
@echo Date:%date% Time:%time: =0% >> log.txt
@ipconfig /all | find "IPv4 Address" >> log.txt
serves what i was exactly wanted :cheers:
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.
heiska
06-18-2011, 02:08 PM
Btw does ipconfig show one's external IP if connecting through NAT on win7?
Btw does ipconfig show one's external IP if connecting through NAT on win7?
Nope, this is me running ipconfig behind my router:
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.