Configuration Network via prompt

Asked

Viewed 2,361 times

0

As deactivated via command prompt the check boxes "Use automatic configuration script" and also "Do not use proxy server for local addresses"?

To disable the proxy, I am using the command:

 "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

I wonder how I can disable the other two check boxes following the same idea of the command I already have. So I leave everything in one . bat

Minha tela de configuração do proxy

3 answers

1

Create a file with the . reg extension (example: proxy.reg) with the code below:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"MigrateProxy"=dword:00000001
"ProxyEnable"=dword:00000001
"ProxyHttp1.1"=dword:00000000
"AutoDetect"=dword:00000000
"ProxyServer"="http://seu_servidor_proxy:80"
"ProxyOverride"=""

Here you enable or disable the proxy

Active

"ProxyEnable"=dword:00000001

inactive

"ProxyEnable"=dword:00000000

To enable "Use automatic configuration script" again, modify the line

"AutoDetect"=dword:00000000

for

"AutoDetect"=dword:00000001

To enable "Do not use proxy server for local addresses" again, modify the line

"ProxyOverride"=""

for

"ProxyOverride"="<local>"

And to put your . reg in a . bat is simple:

REGEDIT.EXE  /S  "proxy.reg"
  • I did what you said, but when I run . reg, it displays me this message: It is not possible to import C:... The specified file is not a Registry script. You can import only registry files

  • Try it this way: REGEDIT.EXE /S "%~dp0 proxy.reg" or by placing the full path where your file . reg

  • I believe you need this Windows Registry Editor Version 5.00 at the beginning of the archive to be recognized

0

Do it the way it’s gonna work:

dim oShell
set oShell = Wscript.CreateObject("Wscript.Shell")
configURL = "script_de_proxy"
configURL0 = ""

if msgbox("Navegar com Proxy?", vbQuestion or vbYesNo) = vbYes then
oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL", configURL, "REG_SZ"
else
oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL", configURL0, "REG_SZ"
end if

Set oShell = Nothing

0

Do it This Way:

dim oShell
set oShell = Wscript.CreateObject("Wscript.Shell")
configURL = "AQUI SEU SCRIPT DE CONFIGURAÇÃO"

if msgbox("Habilitar Proxy?", vbQuestion or vbYesNo) = vbYes then
oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL", configURL, "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.