Results 1 to 8 of 8
  1. #1
    Experienced User
    Overall activity: 0%

    Join Date
    Feb 2008
    Location
    Socket LGA 771
    Posts
    1,785
    Liked
    3 times
    Points
    14,465

    Command line app needed to find external ip

    I am in search of a command line app that shows ONLY the external dynamic ip address.

    But the ipconfig /all shows all info. I only need the external IP.


    Also netsh int ip show ipaddress shows extra info besides the external ip


    I want to use the command line app in a automated batch file and log (append) the output to a file. So I need a command line app that outputs only the external dynamic ip address without any details or copyright text or developer's name.

    There are a lot of GUI apps that show external IP but most of them do not work in command line.
    Last edited by prashanthpai; 02-14-2009 at 11:22 PM.
    Happy To Help

  2. #2
    Experienced User
    Overall activity: 0%

    Join Date
    Aug 2008
    Location
    Hell Of Hearts
    Posts
    1,431
    Liked
    0 times
    Points
    9,185
    Well, i got many applications to do that, but not a single one in cmd. But tell me, why would you need an application for cmd? when your can use it in GUI?

  3. #3
    Senior Techie
    Overall activity: 0%

    Join Date
    Jan 2009
    Location
    Wv, USA
    Posts
    245
    Liked
    0 times
    Points
    3,303
    Are you trying to query against the exip? Like in a bounce, query and send program?

  4. #4
    Experienced User
    Overall activity: 0%

    Join Date
    Feb 2008
    Location
    Socket LGA 771
    Posts
    1,785
    Liked
    3 times
    Points
    14,465
    Quote Originally Posted by heart reaper View Post
    But tell me, why would you need an application for cmd? when your can use it in GUI?
    I want to log my external IP to a file after running a series of commands in batch script. I wouldn't mind using a GUI app but I need it to support commandline bcoz I should use it in middle of batch script and append the ouput to a file.

    Let me be more clear, for example a very simple command like
    ipconfig /all >>output.txt
    will append the output of the command to external file "output.txt" like this
    Code:
    Windows IP Configuration
    
    
    
            Host Name . . . . . . . . . . . . : pc
    
            Primary Dns Suffix  . . . . . . . : 
    
            Node Type . . . . . . . . . . . . : Broadcast
    
            IP Routing Enabled. . . . . . . . : No
    
            WINS Proxy Enabled. . . . . . . . : No
    
    
    
    Ethernet adapter Local Area Connection:
    
    
    
            Connection-specific DNS Suffix  . : 
    
            Description . . . . . . . . . . . : Realtek RTL8139/810x Family Fast Ethernet NIC
    
            Physical Address. . . . . . . . . : 00-00-00-00-00-00
    
            Dhcp Enabled. . . . . . . . . . . : No
    
            IP Address. . . . . . . . . . . . : 192.168.1.2
    
            Subnet Mask . . . . . . . . . . . : 255.255.255.0
    
            Default Gateway . . . . . . . . . : 192.168.1.1
    
            DNS Servers . . . . . . . . . . . : 218.248.240.33
    
                                                218.240.240.135
    
    
    
    PPP adapter DataOne:
    
    
    
            Connection-specific DNS Suffix  . : 
    
            Description . . . . . . . . . . . : WAN (PPP/SLIP) Interface
    
            Physical Address. . . . . . . . . : 00-53-45-00-00-00
    
            Dhcp Enabled. . . . . . . . . . . : No
    
            IP Address. . . . . . . . . . . . : 59.92.000.61
    
            Subnet Mask . . . . . . . . . . . : 255.255.255.255
    
            Default Gateway . . . . . . . . . : 59.92.000.61
    
            DNS Servers . . . . . . . . . . . : 218.248.240.181
    
                                                218.248.240.179
    
            NetBIOS over Tcpip. . . . . . . . : Disabled
    But ipconfig /all has lots of extra info. I want to append only the external IP to the file.
    Last edited by prashanthpai; 02-15-2009 at 12:05 AM.

  5. #5
    Experienced User
    Overall activity: 0%

    Join Date
    Aug 2008
    Location
    Hell Of Hearts
    Posts
    1,431
    Liked
    0 times
    Points
    9,185
    I dont think it is possible. but searching hard might help.

  6. #6
    Administrator
    Overall activity: 46.0%

    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    9,802
    Liked
    1656 times
    Points
    48,740
    Possible and pretty simple.

    Download wget from the link below.
    http://users.ugent.be/~bpuype/wget/wget.exe

    CD to the wget.exe directory and use the following command.
    wget -q -O - http://whatismyip.com/automation/n09230945.asp

    that'd display your external ip address on the command prompt window. If you want it to output to a file, use the command below.

    wget -q -O - http://whatismyip.com/automation/n09230945.asp > IP.txt

  7. #7
    Experienced User
    Overall activity: 0%

    Join Date
    Dec 2008
    Location
    Malaysia
    Posts
    1,608
    Liked
    0 times
    Points
    8,958
    I though it is not simple for me

  8. #8
    Experienced User
    Overall activity: 0%

    Join Date
    Feb 2008
    Location
    Socket LGA 771
    Posts
    1,785
    Liked
    3 times
    Points
    14,465
    Thanks a lot Raymond. I have been using wget in one of my batch files to download and update the ipfilter.dat file in uTorrent folder but never knew all those long list of switches.

    So now I can create a very simple batch file like this which can disconnect and reconnect my net connection (router is in bridge mode) to get a new dynamic IP and then log the new IP.

    Code:
    @echo off
    title Router Connection Resetter by Prashanth Pai
    rasdial DataOne /disconnect >NUL
    sleep 10 >NUL
    rasdial DataOne username password >NUL
    wget -q -O - http://whatismyip.com/automation/n09230945.asp >>IP.log
    echo. >>IP.log
    The sleep utility ^ does not come with XP. I had to get it from Windows Resource Kit.

    Thanks again.
    Last edited by prashanthpai; 02-15-2009 at 09:48 AM.

 

 

Similar Threads

  1. Replies: 3
    Last Post: 04-16-2011, 06:31 PM
  2. Replies: 1
    Last Post: 12-21-2010, 11:39 PM
  3. Sophos Anti-Virus free command line scanner: SAV32CLI
    By sujay in forum Spyware/Viruses
    Replies: 10
    Last Post: 10-06-2010, 01:53 PM
  4. Send files to Recycle Bin via Command Line
    By sujay in forum Tutorials
    Replies: 6
    Last Post: 06-20-2010, 07:10 AM
  5. Replies: 3
    Last Post: 05-18-2010, 12:37 AM
All times are GMT +8. The time now is 06:27 AM.