I think any solution that ensures that stderr/stdout output from LyX and from scripts is visible if started from a command line window (or stderr/stdout is redirected to a file) would be OK.
The logic is clear now: 1. lyx needs stdout/stderr. Even if we can change lyxerr to log to a file, scripts are supposed to inherit console from lyx. The latter is much more difficult to fix. 2. It does not matter whether or not we make lyx a winmain application and create a console through allocconsole(), or make lyx a console application and let windows create a console for it. A black command window will always appear (and disappear afterwards if lyx hides it). The conclusion: it is only possible to suppress cmd.exe from outside of lyx, and the solution, as far as I can find, is the program that Russian geek wrote. Cheers, Bo