[SOLVED] 4.26.2 Source fails with GenerateProjectFiles error

Getting the following error when trying to build 4.26.2 from source.
Any idea how to fix this?

Setting up Unreal Engine 4 project files…
‘“C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere” -prerelease -latest -products * -requires Microsoft.Component.MSBuild -property installationPath’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 /v 15.0 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 /v 15.0 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7 /v 15.0 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7 /v 15.0 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKCU\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKCU\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\14.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\14.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKCU\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKCU\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.
‘REG.exe query HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\12.0 /v MSBuildToolsPath 2>Nul’ is not recognized as an internal or external command,
operable program or batch file.

GenerateProjectFiles ERROR: Unable to find a valid installation of Visual Studio. Please check that you have Visual Studio 2017 or Visual Studio 2019 installed, and the MSBuild component is selected as part of your installation.

MSBuild is enabled in Visual Studio 2019 Community.

Even though I have installed MSBuild 2013 (12.0), it doesn’t seem to make a difference.
reg

Instead of launching the GenerateProjectFiles.bat from the explorer, but the command line, with GenerateProjectFiles.bat -2019 / starts the build. It may be due to the fact that since VS 2019 the registry is no longer maintained by VS.

However, you may find this post here also important [SOLVED] Visual Studio 2019 Source Build -> cmd.exe Access Denied - #3 by unit23