Monday, May 21, 2012

Get Current Dynamic IP Address Remotely

My internet provider gives me external ip address, so I can use Remote Desktop to connect to my home computer from outside. But every 4 hours my ip address is being changed, so every time I must know the new ip address. So I've written a little script, which every minute gets the new ip address and writes it in a text file, which is located in Dropbox folder. Here is my script:

:START
netsh interface ip show config > "C:\Users\user\Dropbox\ip.txt"
PING 1.1.1.1 -n 1 -w 60000 >NUL
GOTO START 

INSTRUCTIONS
1. Copy this text to a text file and rename to ip.bat (Attention: file extension must be .bat), then put the shortcut of this file to a Startup folder (e.g. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup)
2. Change the path in line 2 to your Dropbox, Google Drive or other folder which is synchronizing automatically and is available from internet.
3. You can set that shortcut to start minimized, if you wish...
4. If you use dropbox, you can get the link to ip.txt file and bookmark it in your browser for easy access...



No comments:

Post a Comment