An IP (Internet Protocol) address is used to identify your computer, router or any other network devices in your network or internet. A typical home network router has two IP addresses: one for external internet (WAN) and the other for the internal home (LAN) connection. A router is a hardware device which uses software for performing the routing of data packets in an internal network. All routers are hardware firewalls. Batch file is a text file that contains a set of commands for the operating system of the computer. To get the router IP address from a batch file you need to create two files- getip.js and GetIP.bat by writing the right codes. Run the .bat file which will create .txt file called IP.txt containing your external IP address or internet IP address.
I have a slight problem and am looking for some help!!
OK, I need a bat file to run daily to tell me what my "ADSL" Router's IP is (ie. 91.80. etc etc) and not the local IP of 192.168 etc.
This is because Sky (ISP) does not support static IPs so this changes when the router gets rebooted.
Please follow these instructions:
- Right click desktop and select new txt document.
- Open the newly created .txt file and paste the following code into it:
var request = new ActiveXObject("Msxml2.XMLHTTP");
var notyetready = 1;
notyetready = 0;
request.open( "GET", "http://www.whatismyip.com/automation/n09230945.asp", true );
while( notyetready )
WScript.Sleep( 100 );
- Safe 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
- Safe 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.
Thanks to Flo-TLSC
for this tip on the forum.