none
Disable Internet for a set period of time

    Question

  • Is there a way to turn off the internet for a set period of time like a kill switch button. 

    I would want to be able to press a hotkey on my laptop and be able to turn off all internet access for like 30 minute or so

    Saturday, July 30, 2011 6:45 PM

Answers

  • The OP asked about having a function to disable the internet for a period by clicking on "something", not to know how to set up a given time and duration.

    So, if the user were to use the scheduler or parental controls, they would be forced to edit the schedule or parental controls start time and duration each time they want to turn it off/on.

    That's far more effort than just having two separate disable/enable batch files, I simply added a means to add a timeout. 

    dharmil16:

    To run it with no window, you would have to call the batch file with VBScript (or some other scripting language) with specific options set, and I don't feel comfortable with  introucing non-technical people to both scripting and batch files.  If you are technical person, this information is readily available from other sources.

    If you want to run it minimized, it starts getting more complex...

    Move the complete (3) line batch file to some place (My Documents)?, then right-click-drag it from that new location to the destop and select "create shortcut here".  Now right click on that shortcut and in the Run drop-down, select "minimized", click on "Apply" and close the properties dialog.  Now when you run it, it should run minimized, you should see an icon in the taskbar, and once the timeout has expired, the icon will disappear, letting you know the connection is re-established.

    What if you clicked on it but decided you need access before you thought you would?

    I'd suggest keeping a separate batch file around with a single line as follows:

     netsh interface set interface name="Local Area Connection" enable

    This one simply re-enables the interface, and when the timeout finally happens (from the original Internet_Sleep.bat) and re-enables it AGAIN, it shouldn't cause any issues.

    Be very careful with scripting and batch programming, these are powerful tools that need to be understood at the deepest levels.  In other words, you NEVER want to just start poking around to find out what might happen, one of the things that might happen is you completely destroy your operating system and need to re-install.

    The only reason I posted in this thread then was Niki set the stage by getting the OP involved in batch programming, but didn't satisfy the OPs needs.  Had Niki not posted first, I would certainly not have tried to get people playing around with batch or script programming...

    This is not meant to offend, I'm just rtying to protect people.  I see people clicking on things all the time to "see what it does", as soon as you start experimenting with no genuine idea of EXACTLY what is supposed to happen, you can easily render your system inoperative.

    Careful!!!

    DAS

    Thursday, August 04, 2011 3:14 PM

All replies

  • Read your owner's manual or contact your laptop's Technical Support.

    Most, if not all, laptops have a "switch" for the wireless card and may also have a "switch" for the ethernet LAN card.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
    Saturday, July 30, 2011 6:59 PM
  • yeah all laptops have a switch to turn it off, but its only til you turn it back on. I was wondering if you can make it a set period of time

     

    Saturday, July 30, 2011 7:07 PM
  • "bobbymunny" wrote in message news:6fe6d5f5-df9d-44fa-8e4a-458bc832bd74...

    yeah all laptops have a switch to turn it off, but its only til you turn it back on. I was wondering if you can make it a set period of time

     


    You could try using a Scheduled Task for the job - but I have no real idea how to go about it :)
     

    --


    Noel Paton | Nil Carborundum Illegitemi | CrashFixPC | The Three-toed Sloth
    Sunday, July 31, 2011 11:16 AM
  • Hi,

     

    If you want to turn off the Internet, you can disable Local Area Connection for a period of time.

     

    If you want to turn off the Internet on a schedule time, you can set task scheduler as below.

     

    1. Open Notepad, add the following content and save as disable.bat onto desktop.

     

    netsh interface set interface name="Local Area Connection" disable

     

    2. Open Notepad, add the following content and save as enable.bat onto desktop.

     

    netsh interface set interface name="Local Area Connection" enable

     

    3. Open Task Scheduler, in the right pane, click Create Task.

    4. On General tab, type name: Stop Internet, select option for Run with highest privileges, Configure for: Windows 7, Windows Server 2008 R2

    5. On Triggers tab, Create New, Begin the task: On a schedule, One time: set the time what you want, click OK to save the New Trigger.

    6. On Actions Tab, Create New, Action: Start a program, click Browse to find disable.bat, click OK to save the New Action.

    7. Click OK to save the task. After that, use the same way to create another Task named Enable Internet. On Triggers tab, set a period of time after the first task. For example, the first task runs in 10:30 AM, the second task runs in 11:00 AM, the Internet will be disabled for 30 minutes.

     

    Best Regards,

    Niki

     


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, August 04, 2011 9:40 AM
    Moderator
  • Niki's solution adresses the time aspect, but does not offer the flexibility of the click to disable.  Instead, you would have to set up the scheduler every time you want it to happen at different points during the day.

    However, the soluction does provide 2 important elements, the Disable/Enable batch commands.

    The easiest solution is to cause the file to wait (timeout):

    netsh interface set interface name="Local Area Connection" disable

     

    timeout /t 1800 /nobreak > NUL

     

    netsh interface set interface name="Local Area Connection" enable

    You can place all (3) lines in a file named Internet_Sleep.bat (or whatever name you like before the .bat), then click on that file to start the sleep.  1800 is the number of seconds, in this case, 30 minutes.

     

    Note, this opens a command window the instant you click it, and will remain open until it times out and re-enables the connection.  This could be a valuable indicator, but if you don't care to have the window open, we could provide a way to run it minimized or even "hidden", but personally I'd like having the window there to let me know.

     

    Lastly, the timeout above is set to ignore keystrokes when the command window is in focus, alternatively, you could allow keystrokes so you can disable the batch, but then you'd need Niki's second batch to turn the interface back on.

     

    Niki gave you a good start, hopefully you find my addition useful, and if you need to tailor it a bit, repost and we'll try and help you out.

     

    DAS

    • Proposed as answer by dharmil16 Thursday, August 04, 2011 4:19 PM
    Thursday, August 04, 2011 11:10 AM
  • Hey can u pls. tell me how do i run it as hidden ???
    Thursday, August 04, 2011 2:11 PM
  • http://windows.microsoft.com/en-US/windows7/products/features/parental-controls

    Why not use windows parental controls to lock downinternet access during cetain times?


    :P Advice offered, If you need more help it is advised to seek the council and advice of paid professionals. The answer is always 42, or reboot.
    Thursday, August 04, 2011 2:28 PM
  • http://windows.microsoft.com/en-US/windows7/products/features/parental-controls

    Why not use windows parental controls to lock downinternet access during cetain times?


    :P Advice offered, If you need more help it is advised to seek the council and advice of paid professionals. The answer is always 42, or reboot.

    'coz i only have 1 account.

    so i cant apply parental controls

     

    & moreover i need it to be flexible

    Thursday, August 04, 2011 2:51 PM
  • The OP asked about having a function to disable the internet for a period by clicking on "something", not to know how to set up a given time and duration.

    So, if the user were to use the scheduler or parental controls, they would be forced to edit the schedule or parental controls start time and duration each time they want to turn it off/on.

    That's far more effort than just having two separate disable/enable batch files, I simply added a means to add a timeout. 

    dharmil16:

    To run it with no window, you would have to call the batch file with VBScript (or some other scripting language) with specific options set, and I don't feel comfortable with  introucing non-technical people to both scripting and batch files.  If you are technical person, this information is readily available from other sources.

    If you want to run it minimized, it starts getting more complex...

    Move the complete (3) line batch file to some place (My Documents)?, then right-click-drag it from that new location to the destop and select "create shortcut here".  Now right click on that shortcut and in the Run drop-down, select "minimized", click on "Apply" and close the properties dialog.  Now when you run it, it should run minimized, you should see an icon in the taskbar, and once the timeout has expired, the icon will disappear, letting you know the connection is re-established.

    What if you clicked on it but decided you need access before you thought you would?

    I'd suggest keeping a separate batch file around with a single line as follows:

     netsh interface set interface name="Local Area Connection" enable

    This one simply re-enables the interface, and when the timeout finally happens (from the original Internet_Sleep.bat) and re-enables it AGAIN, it shouldn't cause any issues.

    Be very careful with scripting and batch programming, these are powerful tools that need to be understood at the deepest levels.  In other words, you NEVER want to just start poking around to find out what might happen, one of the things that might happen is you completely destroy your operating system and need to re-install.

    The only reason I posted in this thread then was Niki set the stage by getting the OP involved in batch programming, but didn't satisfy the OPs needs.  Had Niki not posted first, I would certainly not have tried to get people playing around with batch or script programming...

    This is not meant to offend, I'm just rtying to protect people.  I see people clicking on things all the time to "see what it does", as soon as you start experimenting with no genuine idea of EXACTLY what is supposed to happen, you can easily render your system inoperative.

    Careful!!!

    DAS

    Thursday, August 04, 2011 3:14 PM
  • Can you please show me explicitly

    1) how to run hidden.

    2) can we loop the script so that internet is turned of after 30 min, stay off for 5 min, then turn back on for another 30 min then, stay off for 5 min....so on and so forth - this is to simulate unstable internet connection preventing play online game but homework will not be significantly affected....

    THANK YOU VERY MUCH

    Monday, March 17, 2014 3:47 AM