1

I have test c++ console application which require administrative rights and produce output to console using std::cout << "log"

I am launching this application from test.bat with following content testconsoleapp.exe > test.log EXIT %ERRORLEVEL%

and test.bat was started by virtualbox vboxmanage.exe guestcontrol .. run --wait-stdout --wait-stderr test.bat

And my test.log is empty when I am using function AttachConsole(ATTACH_PARENT_PROCESS)

Current solution is to specify filename for console application and write to file instead of std::cout, but may be there is an easy way

se_pavel
  • 2,181
  • 1
  • 28
  • 42
  • So `testconsoleapp` is being elevated? If I remember correctly, the elevation process breaks output redirection. You'll need to run the batch file with elevated privileges too, or have it elevate itself. – Harry Johnston Jan 13 '17 at 22:52
  • Initially I start process via vboxmanage.exe, so I can't give admin permissions at start – se_pavel Jan 27 '17 at 16:14

0 Answers0