Find my ip in DOS

Dell / Inspirion 1764
March 5, 2010 at 23:15:38
Specs: Windows 7 Home Premium, Athlon 64 3gb
Hi there. I am attempting to create a 1 or 2 line batch file that will simply output my IP address to a file. The only problem I'm having is that I can only get DOS to show me, but when I go to I get

If I could just get my batch file to output, I would be a happy camper. Any thoughts?


PS: I looked and looked and for the life of me could not find anything on google for this.

See More: Find my ip in DOS

March 5, 2010 at 23:17:19
If I could just get my batch file to output

Report •

March 6, 2010 at 23:28:27
I don't think there's an easy way to do this in Windows (DOS doesn't have any native networking capabilities, so I assume you're using the command prompt). The best way I can think of is to download the NT console version of netcat.

You can fetch the contents of a web page with netcat by establishing a connection and then issuing the command "GET /". To script this you would just need to:

1. Create a file to send commands into netcat, such as "commands" with the content "GET /" (without quotes).
2. Run netcat with the command "nc 80 < commands > outputfile

I'm not too good with string operations in batch files, but the IP address should be easy enough to pull out from the output file to someone more competent.

Report •

March 7, 2010 at 07:09:34
Thanks idisjunction. I had a feeling I was going to need a 3rd party tool. I appreciate the help.

Report •
Related Solutions

Ask Question