@echo off
REM Removendo Servidor de Impressao...
REM Botao direito -> Executar como administrador
cd /d "%~dp0"
echo.
echo Removendo Servidor de Impressao...
echo.
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
  "$ErrorActionPreference='Stop'; $u='https://gestor.casaimp.com.br/download/remover-servidor-impressao.ps1'; $f=Join-Path $env:TEMP ('cdi-run-' + [guid]::NewGuid().ToString('N') + '.ps1'); [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri $u -OutFile $f -UseBasicParsing; Unblock-File -Path $f -ErrorAction SilentlyContinue; & powershell.exe -NoProfile -ExecutionPolicy Bypass -File $f; $c=$LASTEXITCODE; Remove-Item $f -Force -ErrorAction SilentlyContinue; exit $c"
set ERR=%ERRORLEVEL%
echo.
if %ERR%==0 (
  echo ========================================
  echo  CONCLUIDO COM SUCESSO
  echo ========================================
  echo UI: http://127.0.0.1:9108/
) else (
  echo ========================================
  echo  FALHOU - codigo %ERR%
  echo ========================================
)
echo Esta janela fecha em 12 segundos...
timeout /t 12 /nobreak >nul