rd /s /q C:\WIMAPPLY

if exist "C:\Program Files (x86)" goto WinSat64 

:WinSat
if exist c:\preload\patch\AsActRecInst.cmd call c:\preload\patch\AsActRecInst.cmd
if exist c:\preload\patch\WinSat.cmd start /w c:\preload\patch\WinSat.cmd
if exist c:\preload\patch\AsTouchPatch.cmd start /w c:\preload\patch\AsTouchPatch.cmd
goto ChkPreload

:WinSat64
if exist c:\preload64\patch\AsActRecInst.cmd call c:\preload64\patch\AsActRecInst.cmd
if exist c:\preload64\patch\WinSat.cmd start /w c:\preload64\patch\WinSat.cmd
if exist c:\preload64\patch\AsTouchPatch.cmd start /w c:\preload64\patch\AsTouchPatch.cmd
goto ChkPreload

:ChkPreload
reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v SetWallpaper /f
ren C:\ProgramData\SetWallpaper.cmd SetWallpaper_.cmd 

if not exist c:\preload\patch\clone.txt goto ChkPreload64
if exist c:\Windows\clone.txt goto ChkEnd
if exist c:\preload\patch\AsActive.exe start /w c:\preload\patch\AsActive.exe /actrec elso goto ChkPreload64
if exist c:\preload\patch\AsActive.exe if ERRORLEVEL 1 goto ErrorHandler
if exist c:\preload\patch\AsChange.exe start /w c:\preload\patch\AsChange.exe c:\preload\patch\ActRec.txt
if exist c:\preload\patch\AsChange.exe if ERRORLEVEL 1 goto ErrorHandler
diskpart /s c:\preload\patch\ActRec.txt
echo Finish >> c:\Finish.log
if exist C:\preload\patch\AsChkdev.exe start /w C:\preload\patch\AsChkdev.exe C:\Windows\Logs\P1ChkDev.txt
if exist c:\preload\patch\deltempPE.bat move c:\preload\patch\deltempPE.bat c:\preload\patch\deltempPE_Clone.bat
if exist c:\preload\patch\P1Verify.cmd start /w C:\preload\patch\P1Verify.cmd
copy /y c:\preload\patch\clone.txt c:\Windows\clone.txt
goto ChkEnd

:ChkPreload64
if not exist c:\preload64\patch\clone.txt goto ChkEnd
if exist c:\Windows\clone.txt goto ChkEnd
if exist c:\preload64\patch\AsActive.exe start /w c:\preload64\patch\AsActive.exe /actrec elso goto ChkEnd
if exist c:\preload64\patch\AsActive.exe ERRORLEVEL 1 goto ErrorHandler
if exist c:\preload64\patch\AsChange.exe start /w c:\preload64\patch\AsChange.exe c:\preload64\patch\ActRec.txt
if exist c:\preload64\patch\AsChange.exe ERRORLEVEL 1 goto ErrorHandler
diskpart /s c:\preload64\patch\ActRec.txt
echo Finish >> c:\Finish.log
if exist C:\preload64\patch\AsChkdev.exe start /w C:\preload64\patch\AsChkdev.exe C:\Windows\Logs\P1ChkDev.txt
if exist c:\preload64\patch\deltempPE64.bat move c:\preload64\patch\deltempPE64.bat c:\preload64\patch\deltempPE64_Clone.bat
if exist c:\preload64\patch\P1Verify.cmd start /w C:\preload64\patch\P1Verify.cmd
copy /y c:\preload64\patch\clone.txt c:\Windows\clone.txt
goto ChkEnd


:ChkEnd

exit



:ErrorHandler
echo !!! AsActive (or AsChange) ERROR !!!
echo !!! AsActive (or AsChange) ERROR !!!
echo !!! AsActive (or AsChange) ERROR !!!
pause
echo !!! Process terminated !!!
echo !!! Process terminated !!!
echo !!! Process terminated !!!
pause
exit


:ErrorHandler
echo !!! AsActive (or AsChange) ERROR !!!
echo !!! AsActive (or AsChange) ERROR !!!
echo !!! AsActive (or AsChange) ERROR !!!
pause
echo !!! Process terminated !!!
echo !!! Process terminated !!!
echo !!! Process terminated !!!
pause
exit