tags:

views:

14

answers:

1

I have a Windows batch script (my.bat) which has the following line:

DTBookMonitor.exe 2>&1 > log\cmdProcessLog.txt

So, from my understanding, this runs DTBookMonitor, redirects STDERR to STDOUT and then redirects STDOUT to the file log\cmdProcessLog.txt.

I then run my.bat. DTBookMonitor runs for a significant amount of time, and when I run my.bat a second time (while it is already running), it immediately exits from the second instance of my.bat.

Is this purely because of the redirection to cmdProcessLog?

A: 

I'd guess it's either due to that, or because DTBookMonitor only allows one instance of it to run at a time. The following test should shed some light on the situation:

  • Run the first (long) instance of DTBookMonitor
  • Run a second instance without redirecting any of its output
  • Alternatively, run a second instance, but redirect the output to a file other than log\cmdProcessLog.txt

Do you get similar results? Different results?

Philip Kelley