Logging bat files, how?


  1. Posts : 9
    Windows 7 Professional 32 bit
       #1

    Logging bat files, how?


    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


  2. Posts : 240
    Win 8 RP, Win 7, XP
       #2

    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


  3. Posts : 2,009
    Windows 7 Ultimate x86
       #3

    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


  4. Posts : 9
    Windows 7 Professional 32 bit
    Thread Starter
       #4

    Ok, cool! Thanks a lot guys! That certainly does help
      My Computer


  5. Posts : 660
    win7
       #5

    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


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:53.
Find Us