Page 1 of 1

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

Posted: 21 Mar 2012 05:33
by kevinbarker
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

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

Posted: 21 Mar 2012 05:48
by Squashman
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

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

Posted: 21 Mar 2012 06:43
by abc0502
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

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

Posted: 21 Mar 2012 09:01
by kevinbarker
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

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

Posted: 21 Mar 2012 10:16
by abc0502
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