0

I have an application MyApp.exe.

I want to redirect its output to a text file. So I write a batch file include the following line:

MyApp.exe > output.txt

That works properly. However, I find MyApp.exe should be run as administrator, so I set its property to "Run as Adminstrator" checked. Then when I run the batch file again, I will see the UAC message when MyApp.exe is invoked, and I will click "Confirm" button to proceed. However, now MyApp.exe output will not be redirected to output.txt any more, it will still be displayed in the standard output. Why?

Thanks

alancc
  • 487
  • 2
  • 24
  • 68
  • 3
    To prevent a security violation of controlling an elevated program from an unelevated one. Elevate the batch file. Your program will inherit. –  Apr 27 '20 at 10:26
  • How are you elevating the program? Are you using `__COMPAT_LAYER`, VBS stuff, or anything else since the answer may change depending on which one you are using. – Nico Nekoru Apr 27 '20 at 15:20

0 Answers0