~ PROXY SWITCHER ~

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

~ PROXY SWITCHER ~

#1 Post by Dos_Probie » 18 Jun 2012 22:32

Hey Guys,
Here's a Proxy Switcher that I put together, Only issue is the main title won't change back
after going to any sub menu..any ideas would be appreciated...

Glad dostips is back and running again ... Dos Probie :P

@echo off&color e&mode con:cols=82 lines=18&title[ ~ PROXY SWITCHER TOOL ~ ]

:Anonymous Proxy Switcher.cmd
:Windows 7
:You may use this code and information is provided "as is".
:Code can be modified to suit your specific requirements.

:MAINMENU
cls
reg add "hkcu\software\microsoft\windows\currentversion\internet settings" /v proxyenable /t reg_dword /d "1" /f
set "iexplorer=%programfiles%\internet explorer\iexplore.exe"
echo.
echo.
echo.
echo. ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo. º º
echo. º Anonymous Proxy Switcher Tool º
echo. º º
echo. ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
:MENU SECTION
echo MAIN SELECTION MENU:
echo +===================+
echo. A.) INSTALL Proxy Server
echo.
echo. B.) CHECK IP and Location
echo.
echo. C.) REMOVE Proxy Server
echo.
echo. D.) EXIT Program
echo.
echo.
:CHOOSEACTION
set /p userinp= When Ready Select: A, B, C, or D then press [ENTER]
set userinp=%userinp:~0,1%
if "%userinp%"=="A" goto INSTALL
if "%userinp%"=="B" goto CHECK
if "%userinp%"=="C" goto REMOVE
if "%userinp%"=="D" goto EXIT
if "%userinp%"=="a" goto INSTALL
if "%userinp%"=="b" goto CHECK
if "%userinp%"=="c" goto REMOVE
if "%userinp%"=="d" goto EXIT

echo.
echo. Invalid choice! Please try again.
echo.
GOTO CHOOSEACTION
echo.
echo. Press any [KEY] to return to the main menu.
pause > nul
GOTO MAINMENU
) else (
echo.
)
:========================================================+
:INSTALL
cls
title Windows 7 - Install Proxy Server
echo.+===================================================+

echo. A. Afghanistan
echo.
echo. B. Australia
echo.
echo. C. Hungary
echo.
echo. D. Indonesia
echo.
echo. E. Nepal
echo.
echo. F. USA
echo.
echo. G. Return to Main Menu
echo.
echo.
echo.
set /p userkey= When Ready Make Your Selection: A, B, C, D, E, F, OR G then press [ENTER]
:http://www.proxynova.com/proxy-server-list/
:Afghanistan
if "%userkey%"=="A" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "180.94.80.18:8080"
if "%userkey%"=="a" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "180.94.80.18:8080"

:Australia
if "%userkey%"=="B" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "180.95.19.8:80"
if "%userkey%"=="b" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "180.95.19.8:80"

:Hungary
if "%userkey%"=="C" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "178.48.2.237:80"
if "%userkey%"=="c" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "178.48.2.237:80"

:Indonesia
if "%userkey%"=="D" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "182.253.3.154:8080"
if "%userkey%"=="d" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "182.253.3.154:8080"

:Nepal
if "%userkey%"=="E" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "182.50.64.71:8080"
if "%userkey%"=="e" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "182.50.64.71:8080"

:USA
if "%userkey%"=="F" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "205.213.195.70:8080"
if "%userkey%"=="f" set key=REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D "205.213.195.70:8080"

:Return MainMenu
if "%userkey%"=="G" goto MAINMENU
if "%userkey%"=="g" goto MAINMENU
Start %key%
cls
echo.
echo.
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo Ý ÚÄÄÄ¿Þ
echo Ý Proxy Installed Successfully! ³ û ³Þ
echo Ý ÀÄÄÄÙÞ
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
echo.
echo.
echo.
echo.
echo. Press any [KEY] to return to the Main Menu.
pause > nul
GOTO MAINMENU
:========================================================+
:CHECK
title Windows 7 - Check Your IP Address and Location
@start "" "%iexplorer%" http://www.showipinfo.net/
cls
echo.
echo.
echo.
echo. Press any [KEY] to return to the Main Menu.
pause > nul
GOTO MAINMENU
:========================================================+
:REMOVE
title Windows 7 - REMOVE PROXY SERVER
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D ""
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /T REG_SZ /F /D ""
cls
echo.
echo.
echo.
echo. Press any [KEY] to return to the Main Menu.
pause > nul
GOTO MAINMENU
:========================================================+
:EXIT
title Windows 7 - CLOSING PROXY SWITCHER TOOL
cls
set /p =CLOSING MENU In: <nul
for /l %%a in (5 -1 1) do (
set /p =%%a Seconds.. <nul&ping -n 2 127.1 >nul
)
exit,0

:06.18.12 - Dos_Probie
:"Boredom is the Mother of Invention"

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: ~ PROXY SWITCHER ~

#2 Post by Dos_Probie » 18 Jun 2012 23:41

code did not format right when I pasted it here ...

here is d/l link: https://www.yousendit.com/download/QlVq ... MHhvSWNUQw

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

Re: ~ PROXY SWITCHER ~

#3 Post by Squashman » 19 Jun 2012 06:13

Dos_Probie wrote:code did not format right when I pasted it here ...

Because you didn't use CODE TAGS!

You realize that the IF command has a case insensitive switch.

I am usually not a big fan of using reserved commands for Labels or variable names. If I do have the need to do that then I put an underscore before them to distinguish it from a reserved command.

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: ~ PROXY SWITCHER ~

#4 Post by Dos_Probie » 19 Jun 2012 09:42

Thanks for the info Squash .. my bad

Now If I could just figure out how to use set/p to prompt
for a server address to reg add data variable to registry I would be a
happy camper..

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

Re: ~ PROXY SWITCHER ~

#5 Post by Squashman » 19 Jun 2012 10:08

Using SET /P should be no different then how you are using SET /P in your existing script.

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

Re: ~ PROXY SWITCHER ~

#6 Post by Squashman » 19 Jun 2012 10:12

Not sure why you continue to spell out the whole REG ADD. Make that whole line a variable or just put it in with your START %key% command. Your %key% variable could just be the IP address and port.

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: ~ PROXY SWITCHER ~

#7 Post by Dos_Probie » 19 Jun 2012 10:22

Not sure why you continue to spell out the whole REG ADD. Make that whole line a variable or just put it in with your START %key% command. Your %key% variable could just be the IP address and port.


Sounds like a good time saver Squash .. Can u give me an example so I wont have to copy and paste in reg add every time .. Thanks :roll:

Fawers
Posts: 187
Joined: 08 Apr 2012 17:11
Contact:

Re: ~ PROXY SWITCHER ~

#8 Post by Fawers » 19 Jun 2012 16:27

Dos_Probie wrote:
Not sure why you continue to spell out the whole REG ADD. Make that whole line a variable or just put it in with your START %key% command. Your %key% variable could just be the IP address and port.


Sounds like a good time saver Squash .. Can u give me an example so I wont have to copy and paste in reg add every time .. Thanks :roll:

Just like that "iexplorer" thing I told you on the other thread, right?

Btw, I'd love to give you one or two examples, but registry messing is not with me.

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: ~ PROXY SWITCHER ~

#9 Post by Dos_Probie » 19 Jun 2012 19:35

"Your %key% variable could just be the IP address and port"


Thanks for responding back Fawers..
This must be beyond my pay grade but I tried using the REG ADD variable
with the Set Reg=HKCU\Software\Blah\Blah and then the REG ADD "%Reg%"
which works Fine if the /D data entry is always the same, but it would not
work with my code because of the ever changing IP and Port /D registry
entries.

btw, the start "" "%iexplorer%"... worked great but it does lock you in with IE so I switch over to start http:// which now launches the Default Browser and is a shorter script.

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

Re: ~ PROXY SWITCHER ~

#10 Post by Squashman » 19 Jun 2012 20:18

Dos_Probie wrote:
"Your %key% variable could just be the IP address and port"


Thanks for responding back Fawers..
This must be beyond my pay grade but I tried using the REG ADD variable
with the Set Reg=HKCU\Software\Blah\Blah and then the REG ADD "%Reg%"
which works Fine if the /D data entry is always the same, but it would not
work with my code because of the ever changing IP and Port /D registry
entries.

Each one of those can be a variable! That will cut down on your amount of code.

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: ~ PROXY SWITCHER ~

#11 Post by Dos_Probie » 19 Jun 2012 23:07

OK took your advice and streamlined my proxy batch file with set variable then goto for my %proxy% variable.
also changed menu to if /I '%choice%'=='A' Goto Australia etc. etc.

Now have a lot less code and only have REG ADD and Press [ENTER] One time! see code snippet below

Thanks again everyone for all the help.. :D

Code: Select all

:Australia
set proxy=XXX.XX.XX.XX:XXXX
goto proxy

:USA
set proxy=XXX.XX.XX.XX:XXXX
goto proxy

:Proxy
REG ADD "hkcu\software\microsoft\windows\currentversion\internet settings" /v proxyserver /t reg_sz /d "%proxy%" /f >nul
echo Press [ENTER] to return to Main Menu
pause >nul
cls
goto menu

Post Reply