Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to test how an application that uses an Internet connection to work behaves when there is no Internet. I disable/enable my network connection each time to test. Is there a way to do this in a single click using software?

share|improve this question
... What's wrong with pulling the plug? – Ignacio Vazquez-Abrams Jun 29 '10 at 5:48
I am looking for something easier. The plug is behind the desk and is hard to reach. – Gerhard Jun 29 '10 at 5:51
So then get a coupler, or a switch you can put on the desk. – Ignacio Vazquez-Abrams Jun 29 '10 at 5:57
up vote 2 down vote accepted

Create a batch file with the code

ipconfig /release
pause > nul
ipconfig /renew

just run the batch file to disconnect then press any key to restore network connectivity.

share|improve this answer
Exactly what I need! – Gerhard Jun 29 '10 at 7:57
I would put an "echo Press any key to enable network..." before the pause, just in case you forget what the window is for (maybe you take a break or something)... – Hello71 Jun 29 '10 at 23:59
I created two batch files NetOff.bat and NetOn.bat – Gerhard Jun 30 '10 at 5:24
If they're short @Gerhard: paste them in your answer and I will add them to @john's answer. Great to hear his solution worked! – Ivo Flipse Jun 30 '10 at 6:32
netoff.bat contains ipconfig /release and neton.bat contains ipconfig /renew These commands can also be used with AutoHotkey. – Gerhard Aug 3 '10 at 10:59

You could download some macro recorder, and record a macro for both enabling and disabling the network adapter(s).

share|improve this answer

You can use Net Profiles to disable/enable your internet connection. Create a profile for your current settings by which internet is enabled. Create another profile with a false proxy server by which internet is disabled. Then you can switch between these profiles to enable/disable the internet connection.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .