Computing.Net > Forums > Programming > Note log with date and time stamp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Note log with date and time stamp

Reply to Message Icon

Name: fire_dads
Date: February 4, 2009 at 08:46:07 Pacific
OS: Microsoft Windows Vista Home Premium
CPU/Ram: 2.4 GHz / 2036 MB
Product: Dell / Inspiron 530
Subcategory: General
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Holla
Date: February 5, 2009 at 01:20:46 Pacific
Reply:

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.


0

Response Number 2
Name: klint
Date: February 5, 2009 at 05:39:06 Pacific
Reply:

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.


0

Response Number 3
Name: fire_dads
Date: February 5, 2009 at 10:20:29 Pacific
Reply:

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


0

Response Number 4
Name: Holla
Date: February 5, 2009 at 21:33:52 Pacific
Reply:

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.


0

Response Number 5
Name: lee123abc
Date: February 6, 2009 at 04:56:19 Pacific
Reply:

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


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Note log with date and time stamp

batch file name date and time www.computing.net/answers/programming/batch-file-name-date-and-time/15060.html

list file's current date and time. www.computing.net/answers/programming/list-files-current-date-and-time/11922.html

Date and time in VB www.computing.net/answers/programming/date-and-time-in-vb/9009.html