4

Preciso de uma bat para ativar e desativar proxy já com os ips setados alguem pode me ajudar ?

Para ativar uso o seguinte comando:

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

Desativar:

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

Preciso que ele ja ative com o ip e a porta que eu quero como faço isso?.

6
  • Windows ou linux? a opção de proxy do navegador? poderia detalhar mais a pergunta?
    – rray
    23/01/2015 às 12:00
  • windows, todas as maquinas seriam no windows ! 23/01/2015 às 12:05
  • O que tentou até o momento ?
    – gmsantos
    23/01/2015 às 13:08
  • para ativar - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x00000001 /f 23/01/2015 às 13:10
  • para desativar - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x00000000 /f 23/01/2015 às 13:10

3 Respostas 3

2

Para o Google Chrome, você pode usar as opções de linha de comando --proxy-server para usar um servidor proxy especifico e --no-proxy-server para conexões diretas.

A lista completa de opções de linha de comando pode ser visto aqui.

Para o Internet Explorer você pode criar um arquivo .reg e colocar esse conteúdo:

Regedit4

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

Veja mais detalhes aqui.

Em Batch você pode fazer algo assim:

@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
3
  • e o seguinte man esse exemplo em batch funciona mais ele nao entra ja com o ip e a porta ... 23/01/2015 às 14:34
  • eu coloquei o proxyendereco e a porta ... ficou assim @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 23/01/2015 às 14:38
  • blz agora funcionou vlw,sabe alguma forma de colocar exceções tbm ? 23/01/2015 às 14:50
1

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]

"ProxyOverride"="AQUI AS EXEÇÕES.*;"

0

Você pode fazer o mesmo esquema em apenas um VBS. Segue o script: Após salve como 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

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .