Automatic release and renew

Posted on 2006-04-12
Last Modified: 2007-10-18
I'd like to do a bat file to do ipconfig /release, then ipconfig /renew, but don't know how to write it so that it does step one (release), waits for it to release, then does step two (renew).
Any suggestions?
Question by:maharlika
    LVL 9

    Accepted Solution

    Hello maharlika

    A batch file will wait for the last command to complete before starting the next.  So, simply:

    ipconfig /release
    ipconfig /renew your batch file should do the trick.  Plain and simple!

    Steve :)
    LVL 7

    Assisted Solution

    You can add "@echo off" as the first line too so you don't see the extra prompt.

    I'm not sure if you know how to write a batch file, but it's literally this simple:
     - open up NOTEPAD
     - type in the commands (ipconfig......)
     - save it with a filename ending with  .BAT

    Sometimes a batch file will stop working after it runs a command, such as 'ipconfig'.  It's unlikely in this case, but if it does, add a "CALL" command to the beginning of the line, so it would be:

    @echo off
    call ipconfig /release
    call ipconfig /renew

    LVL 7

    Expert Comment

    by:Eric B
    if you really need to wait 10 seconds between both, download from the resource kit the "sleep" command which is like unix. You can sleep for the number of seconds you want.
    LVL 9

    Expert Comment

    Hello again maharlika,

    Who needs the resource kit?  Use the PING command instead.  Each ping takes 1 sec (by default).  So, to sleep for 10 secs:

    ping -n 10 >nul

    ...but you don't need it.

    Steve :)
    LVL 7

    Expert Comment

    by:Eric B
    its called good programming/scripting practice!! :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Even if you have implemented a Mobile Device Management solution company wide, it is a good idea to make sure you are taking into account all of the major risks to your electronic protected health information (ePHI).
    If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now