dkreifus
Nov 13 2006, 19:08
I am running several batch files in my unattended installation for my corporate image. I want to be able to capture all the text (commands being called, errors, sucesses, etc) into a text file.
Is there a way to do this? I could use >> after every line to append to a single log file, correct?
Taco Bell
Nov 13 2006, 21:17
The >> commend will redirect the output and append it to the specified file, so that is what you want to do dk.
DangerousDave86
Nov 13 2006, 22:10
This WILL work, however it will be time consuming to implement.
Your better off using a 'master' batch file, to run all of your other batch files
for example, if you run 1.bat, 2.bat and 3.bat during install. Instead of adding >> file.txt to every line you could do this:
exec_all.bat:
1.bat >> file.txt
2.bat >> file.txt
3.bat >> file.txt
that will save you adding >> to each line each of the files.
--- Dave
Taco Bell
Nov 13 2006, 23:15
Indeed. Good point DD86.
dkreifus
Nov 13 2006, 23:27
It's what I had originally hoped to do. But the problem is that they all run at different points of the process, and some are called by registries. (runonce, etc)
DangerousDave86
Nov 15 2006, 09:33
QUOTE(dkreifus @ Nov 13 2006, 23:27)

It's what I had originally hoped to do. But the problem is that they all run at different points of the process, and some are called by registries. (runonce, etc)
I'm sure the system would accept >> after any of those commands where ever they are e.g. registry. Why not give it a try on a virtual machine to see if it works that simply.
dkreifus
Nov 15 2006, 10:40
I tried...it didn't seem to take. I'm still experimenting.
Phonics Monkey
Nov 15 2006, 11:53
Have you tried using a loader file for the batch file?
Call X.bat > file.txt
Actually I'm not sure what the second > is for I've always just used one.
Singh400
Nov 15 2006, 17:03
QUOTE(Phonics Monkey @ Nov 15 2006, 11:53)

Have you tried using a loader file for the batch file?
Call X.bat > file.txt
Actually I'm not sure what the second > is for I've always just used one.
Yeah me too, just the one >.
Taco Bell
Nov 15 2006, 17:35
> means write to the specified file--overwriting any existing content.
>> means append to the specified file--preserving the existing content.
DangerousDave86
Nov 18 2006, 06:35
Indeed Taco.
You could try calling " cmd.exe /C "bat1.bat >> file.txt" " dkreifus, that may do the trick.
Or you could settle for a registry entry of "bat1caller.bat" which contains the line "bat1.bat >> file.txt" as a work around - it's still nicer than adding >> to every line in your original scripts.
Edit: I'm pretty sure I've just said what Phonics said, but anyway. The calling script idea should definatly work, the cmd command is unknown, and could be a way of doing it without the additional file.. or it could just fail.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.