Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
DOS/Other
Tag Cloud
access acer asus bios bsod computer crash desktop drive driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network printer problem ram random registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/Other >
Problem with dynamic IP-need a batchfile

Reply  
Thread Tools
dhiraj05's Avatar
Junior Member with 1 posts.
 
Join Date: Aug 2009
Experience: Beginner
29-Aug-2009, 12:21 PM #1
Problem with dynamic IP-need a batchfile
My ISP provides me an internet connection with dynamic IP. when i need to change my ip i simply disconnect my dial-up connection using a bat file (rasdial "dial-up connection name" /disconnect) and reconnect with same bat file using command rasdial "dial-up connection name" username password. It mostly works but sometime it is annoying to find afterward while browsing that my IP has not changed. It happens say once in every 10 to 15 attempts. Can there be a bat file which on execution notes current Ip address then disconnects internet then reconnects and then verifies whether Ip address has changed or not and if IP address has not changed it goes back to disconnect and reconnect until IP address changes.
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
29-Aug-2009, 08:58 PM #2
Posted via Mobile Device
Anything is possible. I have a batch file at work that copies my ip address to the clipboard. you would have to store you old ip in a text file before disconnecting first.
Why do you need your ip address to change?
Squashman's Avatar
Trusted Advisor with 18,706 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
02-Sep-2009, 09:40 AM #3
Here is the code I use to get my IP address in a batch file. All you would need to do is write it out to a text file before disconnecting and then read that file into a variable after reconnecting to see if the IP changed. This may need to be tweaked for your particular computer.
Code:
:: Note: the following code will extract only the last IP address from the list
FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG /ALL ^| FIND "IP Address"') DO FOR %%B IN (%%A) DO SET IPADDR=%%B
OlderAdmin's Avatar
Junior Member with 1 posts.
 
Join Date: Sep 2009
Experience: Advanced
02-Sep-2009, 04:19 PM #4
Try these commands to release and renew your IP address after you change connection types.

ipconfig /release
ipconfig /renew
ipconfig /all

pause
Reply

Tags
batch programming

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:43 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.