• Testado nas seguintes versões do Windows® •:
XP Pro 32 bits, 7 Pro 64 bits, 8.0 Pro 64 bits & 10 Pro 64 bits
:: Acredito que você possa fazer uso do sendKey (em VBS), pra fazer uns envios de teclas de atalho, como TABs, Setas, Etc.. necessárias para chegar ao botão OK
e em seguida enviar o ENTER
, que vai funcionar como um Click!!
@echo off & setlocal enabledelayedexpansion
>"%temp%\_temp_file_4vbs_.vbs"^
(
echo/ Set WshShell = WScript.CreateObject^("WScript.Shell"^)
echo/ Set objShell = WScript.CreateObject^("WScript.Shell"^)
echo/ Wscript.Sleep 1500
echo/ objShell.AppActivate "inetcpl.cpl"
echo/ Wscript.Sleep 100
echo/ WshShell.SendKeys "({UP})"
echo/ Wscript.Sleep 1500
echo/ WshShell.SendKeys "(+{TAB})"
echo/ Wscript.Sleep 1500
echo/ WshShell.SendKeys "(+{UP})"
echo/ Wscript.Sleep 1500
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 1500
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 2000
echo/ WshShell.SendKeys "({ENTER})"
) & set "_temp_vbs=%temp%\_temp_file_4vbs_.vbs"
start "" /w "%Windir%\System32\inetcpl.cpl"
start "" /w "%Windir%\System32\wScript.exe" //nologo "!_temp_vbs!"
del /q /f "!_temp_vbs!" & goto :eof
Obs.: Para abrir direto a aba "conexões" via cmd/bat, use o comando abaixo:
start "" /w rundll32.exe Shell32.dll,Control_RunDLL Inetcpl.cpl,,4
Update: Setando home page e VPN
@echo off & setlocal enabledelayedexpansion
>"%temp%\_temp_file_4vbs_.vbs"^
(
echo/ Set WshShell = WScript.CreateObject^("WScript.Shell"^)
echo/ Set objShell = WScript.CreateObject^("WScript.Shell"^)
echo/ StrHomePage = "http://www.google.com/ncr"
echo/ StringProxy = "http://proxy.stackoverflow.com.br:3128"
echo/ Wscript.Sleep 100
echo/ objShell.AppActivate "inetcpl.cpl"
echo/ for h=1 To Len^(StrHomePage^)
echo/ x = Mid^(StrHomePage,h,1^)
echo/ WshShell.SendKeys x
echo/ Wscript.Sleep 150
echo/ Next
echo/ Wscript.Sleep 1000
echo/ WshShell.SendKeys "({UP})"
echo/ Wscript.Sleep 100
echo/ WshShell.SendKeys "(+{TAB})"
echo/ Wscript.Sleep 100
echo/ WshShell.SendKeys "(+{UP})"
echo/ for i=1 to 3
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 1000
echo/ Next
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 1000
echo/ WshShell.SendKeys "({ENTER})"
echo/ Wscript.Sleep 1000
echo/ WshShell.SendKeys "({BACKSPACE})"
echo/ for j=1 To Len^(StringProxy^)
echo/ x = Mid^(StringProxy,j,1^)
echo/ WshShell.SendKeys x
echo/ Wscript.Sleep 150
echo/ Next
echo/ WshShell.SendKeys "({TAB})"
echo/ WshShell.SendKeys "({END})"
echo/ WshShell.SendKeys " "
echo/ WshShell.SendKeys "2"
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 1000
echo/ for k=1 to 3
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 1000
echo/ Next
echo/ WshShell.SendKeys "({ENTER})"
echo/ for l=1 to 5
echo/ WshShell.SendKeys "({TAB})"
echo/ Wscript.Sleep 1000
echo/ Next
echo/ WshShell.SendKeys "({ENTER})"
echo/
) & set "_temp_vbs=%temp%\_temp_file_4vbs_.vbs"
start "" /w "%Windir%\System32\inetcpl.cpl"
start "" /w "%Windir%\System32\wScript.exe" //nologo "!_temp_vbs!"
del /q /f "!_temp_vbs!" && goto :eof