@Echo Off
color 1f
Title Restore Edit with Photos Apps Context Menu
cd %systemroot%\system32
call :IsAdmin

cls
color 1f
echo.
ver | findstr /i " 10\.0\." > nul
IF "%ERRORLEVEL%" EQU "0" goto :Win10
echo This script only works on Windows 10 Kernels.
echo.
pause
exit

:Win10
cls
color 1f
echo.
echo Restore the 'Edit with Photos' Context Menu entry.
Reg add "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /v "ActivatableClassId" /t REG_SZ /d "App.AppX65n3t4j73ch7cremsjxn7q8bph1ma8jw.mca" /f >nul 2>&1
Reg add "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /v "PackageId" /t REG_SZ /d "Microsoft.Windows.Photos_2017.18062.12990.0_x64__8wekyb3d8bbwe" /f >nul 2>&1
Reg add "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /v "ContractId" /t REG_SZ /d "Windows.File" /f >nul 2>&1
Reg add "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /v "DesiredInitialViewState" /t REG_DWORD /d "0" /f >nul 2>&1
Reg add "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /ve /t REG_SZ /d "@{Microsoft.Windows.Photos_2017.18062.12990.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.Windows.Photos/Resources/EditWithPhotos}" /f >nul 2>&1
Reg delete "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /v "ProgrammaticAccessOnly" /f >nul 2>&1
Reg delete "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit" /v "Extended" /f >nul 2>&1
Reg add "HKCR\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit\command" /v "DelegateExecute" /t REG_SZ /d "{4ED3A719-CEA8-4BD9-910D-E252F997AFC2}" /f >nul 2>&1

echo.
echo Done.
echo.
pause
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
)
Cls
goto:eof
