+ Reply to Thread
Results 1 to 3 of 3

Thread: ipconfig /all with external ip

  1. #1

    ipconfig /all with external ip

    Before we begin, here's a tip: never name a batch script or vbs script with the same name of an executable in windows, part of the path variable.
    Meaning: if script is called ipconfig.cmd and you already have an ipconfig.exe it'll create an execution loop. Thus, this script must ne named anything except ipconfig.cmd.


    This script will output your external IP address, and the entire contents of ipconfig /all command in a temporary text file on your desktop and opens the file.
    It is easier to read and copy from notepad than from a command line window. The script will remain open as long as the text file is openend. When you close notepad the file will dele itself.


    The code for the script is:
    Code:
    set "output=%userprofile%\desktop\ipconfig_%random%.txt"
    
    bitsadmin.exe /transfer "Job1" http://ipv4.icanhazip.com/ "%output%"
    set /p ExternalIP=<"%output%"
    echo(>"%output%" && echo(Script Data>>"%output%" && echo(>>"%output%" && echo(   External IP . . . . . . . . . . . : %ExternalIP%>>"%output%"
    
    ipconfig /all >>"%output%"
    notepad "%output%"
    del "%output%"
    Reply With QuoteReply With Quote
    Thanks

  2. Who Said Thanks:

    Bunny (03.01.17) , Codec (29.12.16)

  3. #2
    Moderator anon's Avatar
    Join Date
    01.02.08
    Posts
    39,447
    Activity Longevity
    8/20 19/20
    Today Posts
    1/5 ssss39447
    Quote Originally Posted by Master Razor View Post
    Before we begin, here's a tip: never name a batch script or vbs script with the same name of an executable in windows, part of the path variable.
    Meaning: if script is called ipconfig.cmd and you already have an ipconfig.exe it'll create an execution loop. Thus, this script must ne named anything except ipconfig.cmd.
    I think you can work around this if you redefine PATHEXT in your batch file.
    "I just remembered something that happened a long time ago."
    Reply With QuoteReply With Quote
    Thanks

  4. #3
    That's correct, anon.
    Adding to the script
    Code:
    set PATHEXT=.exe
    will lock the script in seeing only executables.

    But I would still not use it unless I absolutely have to.
    Reply With QuoteReply With Quote
    Thanks

+ Reply to Thread

Tags for this Thread

Posting Permissions

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