Logging bat files, how?

chs4326

New member
Local time
11:20 PM
Messages
9
Hey guys

I want to log the outcome/what happens when I run a .bat file in startup.

How do I do it?

Am not interested in pausing it, just create a log file.


// Chris
 

My Computer

OS
Windows 7 Professional 32 bit
you could put some 'echo' lines in the .bat file before/after important steps/choices like:
.....
echo "important event 1"
....
echo "important event 2"
......
and run the .bat file with redirecting output to a log file:
NameOf.bat >file.log
 

My Computer

Computer Manufacturer/Model Number
Acer Notebook
OS
Win 8 RP, Win 7, XP
CPU
Intel
Just as a small pointer:
NameOf.bat > file.log would overwrite that log with every run. If you want a log over a longer period you just need to use 2 "chevrons":
NameOf.bat >> file.log

-DG
 

My Computer

Computer Manufacturer/Model Number
HP m8000n
OS
Windows 7 Ultimate x86
CPU
DualCore AMD Athlon 64 X2, 2600 MHz 5200+
Motherboard
Asus M2N68-LA (Narra)
Memory
Samsung 2GB DDR2
Graphics Card(s)
Onboard NVIDIA GeForce 6150SE nForce 430
Sound Card
Onboard nVIDIA nForce 6100-430 (MCP61P)
Monitor(s) Displays
Westinghouse 19" LED
Screen Resolution
1280x1024
Hard Drives
SATA II Seagate Barracuda 500GB
USB II WD Elements 500GB
USB II WD My Book 1TB
USB II WD My Book 2TB
PSU
Stock (HP)
Case
Stock (HP)
Cooling
Stock
Keyboard
Logitech Classic KB 200
Mouse
Standard HP opticle USB mouse
Ok, cool! Thanks a lot guys! That certainly does help
 

My Computer

OS
Windows 7 Professional 32 bit
You can even use the chevron / double chevron trick inside the batchfile eg:-

echo "Start Test" >testlog.txt
.
.
do test
echo "Test Complete" >>testlog.txt
 

My Computer

OS
win7
Back
Top