What exactly are you trying to do? If you compile an Unreal game for Win32 or Win64, it creates a PE (portable executable) file already. Do you mean that you want to compile it monolithically (with no DLLs hanging around)? If so, non-editor builds and ‘programs’ both compile in monolithic mode by default.
If you want to create a standalone program that uses the core but maybe doesn’t use the renderer, etc…, then check out stuff like UnrealHeaderTool or SlateViewer in the UE4 solution.
While my monotonous driving for work, I think I stumbled on an easier way of doing this than using Windows PE after some brainstorming. The idea behind it is to use the power of UE4 to build an OS shell for Windows (for VR). I have a bit of coding to research and learn about incorporating the OS level “stuff” into a “game”, however, the basics of it:
During VRShell install, create a backup copy of explorer.exe
Hook the explorer.exe file to the “Game”
Restart the computer
Load the “game” instead of explorer.exe
(Of course, the user will have to white-list the VRShell in their antivirus program, as this is what 75% of viruses/malware do…)
Now, in order to launch specific applications (is application VR or 2D), there will need to be an initial user setup during the installation, where the game will parse the user’s active applications, and ask the user if the application is VR-enabled or not. It will then create a database of applications and their support for VR.
Post-VR Shell installation, if the user installs a program, then the game should ask if the program is VR-enabled or not post-installation, and update the DB accordingly.
Oh, and to answer your question about “PE”… you can think of Windows PE as being a command line only version of windows, for the most part. More info can be found here: What is Windows PE? | Microsoft Docs