Jump to content
Sign in to follow this  
elchaca

stop internet for 20 sec

Recommended Posts

I want doing 2 steps i once.

Disable internet for 20 sec and start auto.exebat

@echo on
netsh interface set interface name="Ethernet" admin=disabled

run autoexe.bat

timeout /t 20

netsh interface set interface name="Ethernet" admin=enable
Exit

Share this post


Link to post
Share on other sites

what you intend  for disable internet ?  is  sufficent remove all getway or  want shutdown a router of  your lan ? 

Share this post


Link to post
Share on other sites

You can do it this way, but you have to run this as admin under Windows 8 and above, maybe 7 but can't remember.

RunWait(@ComSpec & " /c netsh interface set interface name=Wi-Fi admin=disabled", "", @SW_HIDE) ; disable wifi, change name as needed
Sleep(20000) ; sleep 20 seconds
RunWait(@ComSpec & " /c netsh interface set interface name=Wi-Fi admin=enabled", "", @SW_HIDE) ; reenable wifi, change name as needed

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

RunWait(@ComSpec & " /c netsh interface set interface name=Wi-Fi admin=disabled", "", @SW_HIDE) ; disable wifi, change name as needed
Sleep(20000) ; sleep 20 seconds

During the 20 sec sleep I want start another program. How to do?

During install another proram  enable interface after 20 sec.

RunWait(@ComSpec & " /c netsh interface set interface name=Wi-Fi admin=enabled", "", @SW_HIDE) ; reenable wifi, change name as needed

Share this post


Link to post
Share on other sites

Instead of a sleep, use a timer. Once the timer hits 20 seconds reenable the network. Look at TimerInit/TimerDiff and AdlibRegister to have it run independently from the main script.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

l have given you enough information to look in the help file at the function names I've given you. Read up on them and come up with a script, if it doesn't work, post the script here and explain what isn't working. We will help you with your script.

I'm not going to post a script for you, as there are a ton of examples to look at on the forum, we at this forum are of the mindset of teaching you how to fish, rather than giving you the fish with no effort.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Is this correct:

#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\Users\Tinus\Desktop\MyRepacker\favicon.ico
#AutoIt3Wrapper_Res_Comment=ElChaca Unattended Releases
#AutoIt3Wrapper_Res_Description=ElChaca Unattended Releases
#AutoIt3Wrapper_Res_LegalCopyright=@ElChaca 2017
#AutoIt3Wrapper_Res_Language=1043
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiStatusbar.au3>

#Region
            #AutoIt3Wrapper_Icon=C:\Users\Tinus\Desktop\MyRepacker\favicon.ico
            #AutoIt3Wrapper_UseUpx=n
            #AutoIt3Wrapper_Res_Comment=ElChaca Unattended Releases
            #AutoIt3Wrapper_Res_Description=ElChaca Unattended Releases
            #AutoIt3Wrapper_Res_LegalCopyright= @ElChaca 2016
            #AutoIt3Wrapper_Res_Language=1043
            #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion

RunWait(@ComSpec & ' /c ' & 'netsh interface set interface name="Ethernet" admin=disabled')

#include <MsgBoxConstants.au3>
Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
Sleep(3000) ; Sleep for 3 seconds.
Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
MsgBox($MB_SYSTEMMODAL, "Time Difference", $fDiff)  
           

Share this post


Link to post
Share on other sites

Now i want run setup.exe  during running timerinit.

 

RunWait(@ComSpec & ' /c ' & 'netsh interface set interface name="Ethernet" admin=disabled')

Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
Sleep(20000) ; Sleep for 20 seconds.
Local $fDiff = TimerDiff($hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
;MsgBox($MB_SYSTEMMODAL, "Time Difference", $fDiff)
RunWait(@ComSpec & ' /c ' & 'netsh interface set interface name="Ethernet" admin=enabled')

RunWait(@ComSpec & " /C " & "setup.exe", "C:\Windows\temp", @SW_HIDE)

Share this post


Link to post
Share on other sites

@elchaca let's take a step back for a moment. Can you please explain what type of application install requires you to disable internet? 

 

==============In case you missed it, this is a Moderator stepping into a thread==============


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

So I have read through the site (translated) and the install guide, but see nowhere where it instructs you to stop the internet. Can you please explain why you need to do this?


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

That doesn't answer my question. Typically requests to disable internet connectivity during an install are in an effort to get around an expired trial period.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...