my console app in a batch file
my bat file:
myprogram.exe >> c:\temp\log.txt
my program is getting a null reference error but not sure why the message is not getting logged in log file. When i run manually in command wi开发者_运维技巧ndow i see the error.
Because >>
is Standard Output and your error goes to Standard Error.
You can pass the error into Standard Output if you catch it and write it to Console
You can also have your batch file output stderr to a log file as well. Try
myprogram.exe >> c:\temp\log.txt 2> c:\temp\err.txt
精彩评论