I have tested the change under XP, 7, and 10 and it seems to be working correctly for me in all of these contexts but we will need to see how it works for everyone in the next beta.
The above solution is not working as expected.
To prevent /run from triggering windows messages during script events, it has to be asynchronous (which also prevents error reporting). But to make /run work during /exit -nr or with calling /exit right after it, it needs to be synchronous.
The ShellExecute()/ShellExecuteEx() APIs are used in many ways, from opening folders, opening default file associations, opening URL protocols, running applications, etc., some of which also need to detect errors, so it's difficult to see a way around the original issue
without breaking other features.
At this point, I cannot see a viable solution, so I will be reverting all changes relating to this issue to v7.56.