Note log with date and time stamp

Dell / Inspiron 530
February 4, 2009 at 08:46:07
Specs: Microsoft Windows Vista Home Premium, 2.4 GHz / 2036 MB
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


See More: Note log with date and time stamp

Report •


#1
February 5, 2009 at 01:20:46
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.


Report •

#2
February 5, 2009 at 05:39:06
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.


Report •

#3
February 5, 2009 at 10:20:29
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 miss

chris


Report •

Related Solutions

#4
February 5, 2009 at 21:33:52
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.


Report •

#5
February 6, 2009 at 04:56:19
Klint... it's great to learn about the .LOG in a text document. Great way to enter a time and date-stamp automatically.

Report •


Ask Question