@echo off

::check activation status, and exit::
WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE LicenseStatus=1 GET LicenseStatus | findstr "1" >nul
IF ERRORLEVEL 1 goto :NOT_LICENSED
RD /S /Q "%WINDIR%\Setup\Scripts" >nul
DEL /F /Q %0% >nul
EXIT

::run loader, if not activated::
:NOT_LICENSED
%~dp0"Windows Loader.exe" /silent /preactivate >nul
cd %~dp0
attrib -R -A -S -H *.*
DEL /F /Q %~dp0"Windows Loader.exe" >nul
SHUTDOWN /R /T 25
DEL /F /Q %0% >nul