Jump to content

Get external IP and dump to text file

T.Vengeance
Go to solution Solved by Juganog,

ok

var request = new ActiveXObject("Msxml2.XMLHTTP");

var notyetready = 1;

request.onreadystatechange=function()

{

if(request.readyState==4)

{

WScript.Echo(request.responseText);

notyetready = 0;

}

}

request.open( "GET", "http://icanhazip.com/", true );

request.send(null);

while( notyetready )

{

WScript.Sleep( 100 );

}

Save your new .txt file. Then rename it: getip.js

Now make another new .txt file and paste this into it:

cscript getip.js >ip.txt

Save the file and then rename it: GetIP.bat

Run the .bat file and it will create a .txt file called IP.txt which contains your 'internet IP address' or external IP address.

Is there a batch file script/CMD command that I can use to automatically run every morning to get my external IP and dump it to a .txt file?

“The value of a college education is not the learning of many facts but the training of the mind to think”

 

Link to comment
Share on other sites

Link to post
Share on other sites

I don't have anything that can help you, however I'm curious as to why you want/need this? 

Link to comment
Share on other sites

Link to post
Share on other sites

I don't have anything that can help you, however I'm curious as to why you want/need this? 

I don't have a static IP and sometimes I wanna RDP from my tablet on my university's wifi. So it'd be nice if I could just use task scheduler on my surface pro 3 to grab my IP every morning.

“The value of a college education is not the learning of many facts but the training of the mind to think”

 

Link to comment
Share on other sites

Link to post
Share on other sites

ok

var request = new ActiveXObject("Msxml2.XMLHTTP");

var notyetready = 1;

request.onreadystatechange=function()

{

if(request.readyState==4)

{

WScript.Echo(request.responseText);

notyetready = 0;

}

}

request.open( "GET", "http://icanhazip.com/", true );

request.send(null);

while( notyetready )

{

WScript.Sleep( 100 );

}

Save your new .txt file. Then rename it: getip.js

Now make another new .txt file and paste this into it:

cscript getip.js >ip.txt

Save the file and then rename it: GetIP.bat

Run the .bat file and it will create a .txt file called IP.txt which contains your 'internet IP address' or external IP address.

Yes Yes Legalize Gay Marriage sure, but have you ever considered Weaponizing Gay?

 

CPU: I5 4690 3.5ghz || MOBO: MSI B85-G43 Gaming Board || RAM: 8GB Corsair Vengance Pro - Red || GPU: Gainward GTX770 Phantom 4gb || PSU: EVGA SuperNova 750W Gold || Case: Thermaltake Urban T31 || SSD: Corsair Force 120GB || HDD: 1TB WD Black
Link to comment
Share on other sites

Link to post
Share on other sites

ok

var request = new ActiveXObject("Msxml2.XMLHTTP");

var notyetready = 1;

request.onreadystatechange=function()

{

if(request.readyState==4)

{

WScript.Echo(request.responseText);

notyetready = 0;

}

}

request.open( "GET", "http://icanhazip.com/", true );

request.send(null);

while( notyetready )

{

WScript.Sleep( 100 );

}

Save your new .txt file. Then rename it: getip.js

Now make another new .txt file and paste this into it:

cscript getip.js >ip.txt

Save the file and then rename it: GetIP.bat

Run the .bat file and it will create a .txt file called IP.txt which contains your 'internet IP address' or external IP address.

WHOOT THANKS :D. I've been searching around, but every time I stumble unto a code similar to the one you got, I'm not sure how to use it (I'm kinda programming inadept now...).

“The value of a college education is not the learning of many facts but the training of the mind to think”

 

Link to comment
Share on other sites

Link to post
Share on other sites

Hopfully it works :) it worked for me and tells you what files you need to make unlike a lot of them out there which are just like hey here is this random code now GOOD LUCK!

Yes Yes Legalize Gay Marriage sure, but have you ever considered Weaponizing Gay?

 

CPU: I5 4690 3.5ghz || MOBO: MSI B85-G43 Gaming Board || RAM: 8GB Corsair Vengance Pro - Red || GPU: Gainward GTX770 Phantom 4gb || PSU: EVGA SuperNova 750W Gold || Case: Thermaltake Urban T31 || SSD: Corsair Force 120GB || HDD: 1TB WD Black
Link to comment
Share on other sites

Link to post
Share on other sites

Hopfully it works :) it worked for me and tells you what files you need to make unlike a lot of them out there which are just like hey here is this random code now GOOD LUCK!

It worked perfectly. Thank you once again :D

“The value of a college education is not the learning of many facts but the training of the mind to think”

 

Link to comment
Share on other sites

Link to post
Share on other sites

God that's a lot of code, typical Windows...

curl ifconfig.me > out.txt

Yay Linux/OS X

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×