Automatic release and renew

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?
LVL 3
maharlikaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sda100Commented:
Hello maharlika

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

ipconfig /release
ipconfig /renew

...in your batch file should do the trick.  Plain and simple!

Steve :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OkigireCommented:
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
...done!

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

...etc
0
Eric BDirector of Information TechnologyCommented:
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.
0
sda100Commented:
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 0.0.0.0 >nul

...but you don't need it.

Steve :)
0
Eric BDirector of Information TechnologyCommented:
its called good programming/scripting practice!! :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.