Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I need some help ,
I am looking for a simple program or script
So I can type text and when I press enter it adds a date and time stamp to the beginning of the line of text. It will need to be able to open the text file to view the log as you go … and add entries. I am not sure how to do this and I could not find anything on the NET so far….I just need a simple program to help me log events as I type them.
And view the log as I go….Thanks
Chris

Chris,
Create a batch file. Contents:
@echo off echo Keep entering lines of text. (Enter empty line to exit) :back set nLine= set /p nLine=Enter line: if not DEFINED nLine goto :eof echo %date% %time% !nLine! >> OutputFile.log goto back--
Holla.

Just create a .TXT file, and put .LOG on the first line. Save and close.
The next time you open it, Notepad will add the current date and time and let you write text in it. Then close it again, re-open it, and Notepad writes another date and time, and so on.

I just tried the batch file
output file results
Thu 02/05/2009 10:07:42.02 !nLine!
Thu 02/05/2009 10:07:47.77 !nLine!
Thu 02/05/2009 10:07:50.72 !nLine!I entered text on the lines but this is what is in the output file...
Cool though, I use to do batch files in dos a long time ago... it's slowly comming back..please review
What did I misschris

Sorry Chris,
My mistake. my cmd.exe is launched with a /V option which makes the above batch file to work.
Anyway, the following should work in your machine:@echo off setlocal enableDelayedExpansion echo Keep entering line of text. (Enter empty line to exit) :back set nLine= set /p nLine=Enter line: if not DEFINED nLine goto :eof echo %date% %time% !nLine! >> OutputFile.log goto back--
Holla.

Klint... it's great to learn about the .LOG in a text document. Great way to enter a time and date-stamp automatically.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |