Results 1 to 7 of 7

Thread: IP appending to text file. Possible ?

  1. #1
    Evelyn's Avatar กก ƃɯo ƃɯo ƃɯo BT Rep: +7BT Rep +7
    Join Date
    Jun 2010
    Location
    ǝsɹǝʌ
    Posts
    762
    under win7 x64, is it possible to append the IP details that we get from
    Code:
    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 ?

  2. Internet, Programming and Graphics   -   #2
    Cabalo's Avatar FileSharingTalker BT Rep: +24BT Rep +24BT Rep +24BT Rep +24BT Rep +24
    Join Date
    Mar 2007
    Location
    European Union
    Age
    48
    Posts
    11,834
    I believe wireshark does that, though I haven't used it thoroughly for quite a while.

  3. Internet, Programming and Graphics   -   #3
    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:
    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)
    Last edited by anon; 06-14-2011 at 10:20 PM. Reason: Automerged Doublepost
    "I just remembered something that happened a long time ago."

  4. Internet, Programming and Graphics   -   #4
    Evelyn's Avatar กก ƃɯo ƃɯo ƃɯo BT Rep: +7BT Rep +7
    Join Date
    Jun 2010
    Location
    ǝsɹǝʌ
    Posts
    762
    Quote Originally Posted by Cabalo View Post
    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 View Post
    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

  5. Internet, Programming and Graphics   -   #5
    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.
    "I just remembered something that happened a long time ago."

  6. Internet, Programming and Graphics   -   #6
    Btw does ipconfig show one's external IP if connecting through NAT on win7?

  7. Internet, Programming and Graphics   -   #7
    Quote Originally Posted by heiska View Post
    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.
    "I just remembered something that happened a long time ago."

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •