Bat to enable and disable proxy

Asked

Viewed 16,370 times

4

I need a bat to activate and disable proxy already with the ips set someone can help me ?

To activate use the following command:

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x00000001 /f

Deactivate:

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x00000000 /f

I need it already activated with the ip and the door I want how do I do it?.

  • Windows or linux? the browser proxy option? could further detail the question?

  • windows, all machines would be in windows !

  • What you tried so far ?

  • to activate - REG ADD "HKEY_CURRENT_USER Software Microsoft Windows Currentversion Internet Settings" /v Proxyenable /t REG_DWORD /d 0x00000001 /f

  • to disable - REG ADD "HKEY_CURRENT_USER Software Microsoft Windows Currentversion Internet Settings" /v Proxyenable /t REG_DWORD /d 0x00000000 /f

  • Only this command is on and off , I need it already on with the ip and the port I want ...

Show 1 more comment

3 answers

2


For Google Chrome, you can use the command line options --proxy-server to use a server proxy specific and --no-proxy-server for direct connections.

The complete list of command line options can be viewed here.

For Internet Explorer you can create a file .reg and put that content:

Regedit4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001
"ProxyServer"="http://<proxyEndereco>:<porta>"

See more details here.

In Batch you can do something like this:

@echo off

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d <proxyEndereco>:<porta> /f
  • and the following man this example in batch works more it does not already enter the ip and the port ...

  • i put the proxyaddre and port ... went like this @echo off REG ADD "HKCU Software Microsoft Windows Currentversion Internet Settings" /v Proxyenable /t REG_DWORD /d 1 /f REG ADD "HKCU Software Microsoft Windows Currentversion Internet Settings" /v Proxyserver /t REG_SZ /d <172.16.7.200>:<3128> /f pause

  • blz now worked vlw,know some way to put exceptions tbm ?

1

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER Software Microsoft Windows Currentversion Internet Settings]

"Proxyoverride"="HERE ARE THE EXCEPTIONS.*;"

0

You can do the same schema in just one VBS. Follow the script: After save as vbs.

dim oShell
set oShell = Wscript.CreateObject("Wscript.Shell")

if msgbox("PROXY [nome da organização], Habilitar?", vbQuestion or vbYesNo) = vbYes then
oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"
oShell.RegWrite "HKCU\Software\Microsoft\Windows\currentVersion\Internet Settings\ProxyServer", "192.168.15.254:3129", "REG_SZ"
else
oShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 0, "REG_DWORD"

End if

Set oShell = Nothing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.