PAUSE SCRIPT In WIN 7 & WIN XP Issues....

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kevinbarker
Posts: 7
Joined: 06 Mar 2012 08:02

PAUSE SCRIPT In WIN 7 & WIN XP Issues....

#1 Post by kevinbarker » 21 Mar 2012 05:33

Hello all.

I have a issue with that we have a Proxy server hard coded into out IE, but when a user log's into a WiFi hotspot, the user is not able to access the Hotspot page to enter the username & password ( do to our proxy settings )

I can up with a script to disable our proxy settings for 2 minutes, then reactivate.... but the DELAY is not working in the script any ideas please.. many thanks

PS i would like this done all in the background, so the user is not aware what is happening..

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
start iexplore http://www.google.co.uk
PAUSE 120
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: PAUSE SCRIPT In WIN 7 & WIN XP Issues....

#2 Post by Squashman » 21 Mar 2012 05:48

The PAUSE command does not take any command line arguments. It requires the users to press a key to continue. Windows Vista & 7 have the TIMEOUT command. That would allow you to pause the script for a set amount of time.

Your other option is to use the PING trick.
ping -n 2 -w 60 127.0.0.1>NUL

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: PAUSE SCRIPT In WIN 7 & WIN XP Issues....

#3 Post by abc0502 » 21 Mar 2012 06:43

As Squashman said
the code will be like that:
[Edited]

Code: Select all

@echo off
cls
set reg=HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings

Reg Add "%reg%" /v "ProxyEnable" /t "REG_DWORD" /d "0" /f

::Explorer launch
c:
cd\
start /min %ComSpec% /c "%systemdrive%\Program Files\Internet Explorer\iexplore.exe" google.co.uk

::Wait and add reg key 1
Timeout /T 120
Reg Add "%reg%" /v "ProxyEnable" /t "REG_DWORD" /d "1" /f


if it is not nessacary to launch the internet explorer remove:

Code: Select all

::Explorer launch
c:
cd\
start /min %ComSpec% /c "%systemdrive%\Program Files\Internet Explorer\iexplore.exe" google.co.uk

and replace with:

Code: Select all

start http://www.google.co.uk

this will launch the defualt browser
Last edited by abc0502 on 21 Mar 2012 10:21, edited 2 times in total.

kevinbarker
Posts: 7
Joined: 06 Mar 2012 08:02

Re: PAUSE SCRIPT In WIN 7 & WIN XP Issues....

#4 Post by kevinbarker » 21 Mar 2012 09:01

WOW - Thanks for your help!

I have an issue, that the proxy server only takes effect if the IE is restarted. Is there a way to enforce this without restarting IE????

Thanks

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: PAUSE SCRIPT In WIN 7 & WIN XP Issues....

#5 Post by abc0502 » 21 Mar 2012 10:16

here is a suggestion:
what if we make the script earlier add the "0" value then start the ie and wait 120 second and then add the "1" value then restart the explorer?

if that could help you in your problem try this: (the same script but add new codes)

Code: Select all

@echo off
cls
set reg=HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings

Reg Add "%reg%" /v "ProxyEnable" /t "REG_DWORD" /d "0" /f

::Explorer launch
c:
cd\
start /min %ComSpec% /c "%systemdrive%\Program Files\Internet Explorer\iexplore.exe" google.co.uk

::Wait and add reg key 1
Timeout /T 120
Reg Add "%reg%" /v "ProxyEnable" /t "REG_DWORD" /d "1" /f

::Restart IE
Timeout /T 2
Taskkill /F /im iexplore.exe
Timeout /T 2
start /min %ComSpec% /c "%systemdrive%\Program Files\Internet Explorer\iexplore.exe" google.co.uk

Note: I Changed the Code In my first post so the cmd windows disappear after the code finish
you can change the time it wait that exist after "/T" with seconds

Post Reply