@echo off
TITLE Allow Store to Automatically Update Apps
COLOR 1F
echo.

cd %systemroot%\system32
call :IsAdmin
CLS
TITLE Allow Store to Automatically Update Apps
COLOR 1F

REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /f >nul 2>&1
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v "AutoDownload" /f >nul 2>&1

REG ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /v "AutoDownload" /t REG_DWORD /d "4" /f >nul 2>&1
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v "AutoDownload" /t REG_DWORD /d "4" /f >nul 2>&1
reg add "HKLM\SOFTWARE\Policies\Microsoft\WindowsStore" /v "DisableStoreApps" /t REG_DWORD /d "0" /f >nul 2>&1

SCHTASKS /Change /TN "Microsoft\Windows\WindowsUpdate\Automatic App Update" /ENABLE >NUL 2>&1

echo.
echo Done.  A reboot maybe required.

:Finished
TIMEOUT /T 5 >NUL 2>&1
exit

:IsAdmin
Reg.exe query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
 Cls
 echo.
 Echo You must have administrator rights to continue...
 echo.
 Pause
 Exit
)
