Really stupid Windows batch echo question

Status
Not open for further replies.
I'm working on writing a pretty simple Windows batch file. The batch needs to call another batch, which we'll call batch2 (batch2 will be dynamically generated by a separate process). I want to log all of the activity from batch2, but not just the output from the commands it runs.

Here's what I have so far:

main batch
Code:
call batch2.bat >> batch2log.log

batch2
Code:
command-1
command-2
command-3

The output from each command in batch2 is normally "Command completed successfully." The problem is, all I end up with in the log file is this:

Code:
Command completed successfully.
Command completed successfully.
Command completed successfully.

What I really need in the log is this:

Code:
command-1
Command completed successfully.
command-2
Command completed successfully.
command-3
Command completed successfully.

Any idea what I need to tweak to get this? It would be preferable to handle all of the logging commands from within the main batch file, instead of inside batch2. Thanks!
 
[url=http:/civis/viewtopic.php?p=30637105#p30637105:3e4iumjp said:
andrewd18[/url]":3e4iumjp]Does your second batch script have "@ECHO OFF" set? Because by default every line in a batch file gets output to STDOUT.

No, @ECHO OFF isn't set in batch2, but it is set in the main batch. For testing I just disabled it there as well, and now it does log all the commands, though it also logs the path to batch2. So my log looks like this:

Code:
c:\Program Files\Application Name Goes Here\>command-1 
Command executed successfully.

Sadly, I need to run batch2 directly in that path because it runs commands against an executable located there. It would be nice to figure out how to eliminate the path from the log.
 
Status
Not open for further replies.