speedygonzalez
asked on
Output Batch File Details To Log?
Hello, I have a batch file on windows which holds the following commands
cd e:\MyTester\testAcc
echo version_1.0 Running batch file for Updater
java -cp ".;e:\MyTester\testAcc\jdb c_jar_file \classes12 .jar" com.myco.utility.updater.C ontroller
I wish to write the complete output of what happens while it processes to a log file.
Do you know how I can do this? I though echo could be used but I could not get it to write out all the contents.
Thanks in advance.
cd e:\MyTester\testAcc
echo version_1.0 Running batch file for Updater
java -cp ".;e:\MyTester\testAcc\jdb
I wish to write the complete output of what happens while it processes to a log file.
Do you know how I can do this? I though echo could be used but I could not get it to write out all the contents.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
2>&1: Write both standard output and standard error of command to file
Rene.. i meant if you appended stdout but redirected stderr to stdout without append.... Would be easy enough to check but presumably don't need to append both? anyway will do test boh ways when on pc at some point.
@Steve
I had a feeling that your question would be not that easy to answer, since your the one that introduced me to that feature. ;)
I use: >> "%LogFile%" 2>&1
Never tried: >> "%LogFile%" 2>>&1
Cheers
I had a feeling that your question would be not that easy to answer, since your the one that introduced me to that feature. ;)
I use: >> "%LogFile%" 2>&1
Never tried: >> "%LogFile%" 2>>&1
Cheers
Seems it doesn't make any difference... I suppose if you specified the filename twice it would.
Steve
Steve
Steve, was your message addressed to me?
sorry Rene yes... just saying that >>file.txt 2>&1 seems to do the same as >>file.txt 2>>&1 though I guess >>file.txt 2>file.txt might be messy.
Had never tried before btw below which solved an issue I was dealing with elsewhere (real life not EE!) with parsing stderr output if there was one:
commandname.exe 2>&1 | find /i "error"
before I piped stderr into a file and ran find over it and had never thought to that until triggered by this q...
Anyway must shut up. completely OT.
Steve
Had never tried before btw below which solved an issue I was dealing with elsewhere (real life not EE!) with parsing stderr output if there was one:
commandname.exe 2>&1 | find /i "error"
before I piped stderr into a file and ran find over it and had never thought to that until triggered by this q...
Anyway must shut up. completely OT.
Steve
Thanks for your feedback Steve!
It would appear speedy isn't...
~bp
~bp
speedygonzalez
What does your java program do?
What does your java program do?
ASKER
Hi All, Apologies. As with other questions I've posted in the past on E-Exchange I then got pulled away to work on something else for a few weeks before getting back to my questions. Your help has been very much appreciated. I ended up using ReneGe's code snippet in his answer with "To also output errors, add "2>&1"" but all of the answers were a help.
Thanks again!
Thanks again!