Actually, I am using C++. I specified a file name generation in the options, it did capture the screenshots, but the files were still saved to a weird location as showed in the log. I decided to use another function anyway.
Here is how it gets weird in UE 5.2: