How to call TakeHighResScreenShot in code

I am using GWorld->GetGameViewport()->Exec("HighResShot 3008x2000 0 0 0 0 0 1 1 1") in the code to take high-resolution screenshots, which works correctly in the engine. However, after packaging for Windows, it only generates a .png image and does not create an .exr file. I have also tried using the “take high res screenshot” and “execute console command” nodes in the level blueprint, but with no success. Why could this be happening?