I use Windows batch files to execute various Stata do-files in a certain order. For example, when I do
StataMP-64 /e do myDoFile1.do
StataMP-64 /e do myDoFile2.do
Stata executes `myDoFile1.do` and nicely routes its output to `myDoFile1.log`, and then executes `myDoFile2.do` and routes its output to `myDoFile2.log`. By the way, both log files are in the same directory as the do-files.
Now I want to pass an argument for each of these do-file. In particular, this argument is a directory path. For example,
StataMP-64 /e do myDoFile1.do "C:\MyDir"
StataMP-64 /e do myDoFile2.do "C:\MyDir"
Now Stata executes `myDoFile1.do` as expected, but saves its output to a file named `MyDir.log`. And it does the same to `myDoFile2.do`, overwriting the log for `myDoFile1.do`.
Attached is a screenshot showing an example -- the batch file, the do file and the log file. I also tried the command prompt directly just in case.
I'm on Windows 7. I tried this with Stata 13 MP and Stata 12 SE.
Questions:
---------
1. Is this the expected behavior?
2. How to solve this, and have outputs routed to `myDoFile1.log` and `myDoFile2.do` respectively, preferably without the need to explicitly starting to log in each do file?
Note:
-------
I asked this same question in StackOverflow, and someone claimed to have tried to reproduce this in Windows XP, and got (what I think is) the expected result (i.e., log file name was indeed `myDoFile1.log`.
StataMP-64 /e do myDoFile1.do
StataMP-64 /e do myDoFile2.do
Stata executes `myDoFile1.do` and nicely routes its output to `myDoFile1.log`, and then executes `myDoFile2.do` and routes its output to `myDoFile2.log`. By the way, both log files are in the same directory as the do-files.
Now I want to pass an argument for each of these do-file. In particular, this argument is a directory path. For example,
StataMP-64 /e do myDoFile1.do "C:\MyDir"
StataMP-64 /e do myDoFile2.do "C:\MyDir"
Now Stata executes `myDoFile1.do` as expected, but saves its output to a file named `MyDir.log`. And it does the same to `myDoFile2.do`, overwriting the log for `myDoFile1.do`.
Attached is a screenshot showing an example -- the batch file, the do file and the log file. I also tried the command prompt directly just in case.
I'm on Windows 7. I tried this with Stata 13 MP and Stata 12 SE.
Questions:
---------
1. Is this the expected behavior?
2. How to solve this, and have outputs routed to `myDoFile1.log` and `myDoFile2.do` respectively, preferably without the need to explicitly starting to log in each do file?
Note:
-------
I asked this same question in StackOverflow, and someone claimed to have tried to reproduce this in Windows XP, and got (what I think is) the expected result (i.e., log file name was indeed `myDoFile1.log`.