@echo off :: Check for administrator privileges net session >nul 2>&1 if %errorlevel% neq 0 ( echo Requesting administrator privileges... powershell -Command "Start-Process '%~f0' -Verb RunAs" exit /b ) echo Administrator privileges granted. Starting activation... powershell -NoProfile -ExecutionPolicy Bypass -Command ^ "$path = 'C:\Program Files\Microsoft Office\Office16'; ^ if (-not (Test-Path $path)) { $path = 'C:\Program Files (x86)\Microsoft Office\Office16' }; ^ Set-Location $path; ^ Write-Host 'Current folder:' $path -ForegroundColor Yellow; ^ Write-Host 'Setting KMS host kms.helpdesk38.ru...' -ForegroundColor Green; ^ cscript //nologo ospp.vbs /sethst:kms.helpdesk38.ru; ^ Write-Host 'Waiting 5 seconds before activation...' -ForegroundColor Magenta; ^ Start-Sleep -Seconds 5; ^ Write-Host 'Activating Office...' -ForegroundColor Green; ^ cscript //nologo ospp.vbs /act; ^ Write-Host 'Done.' -ForegroundColor Cyan; ^ Read-Host 'Press Enter to exit'" pause