Writing Date and Time to a log file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bmurtha
Posts: 4
Joined: 17 Nov 2015 13:47

Writing Date and Time to a log file

#1 Post by bmurtha » 04 Apr 2016 12:39

I want to keep a log of when ever a file is downloaded. I have this but it says incorrect function whenever I run it:

if exist D:\Test1\LOCK.TXT echo %DATE% %TIME% LOCKBOX.txt file found > LOCKBOX_LOG.txt

Squashman
Expert
Posts: 4470
Joined: 23 Dec 2011 13:59

Re: Writing Date and Time to a log file

#2 Post by Squashman » 04 Apr 2016 13:15

bmurtha wrote:I want to keep a log of when ever a file is downloaded. I have this but it says incorrect function whenever I run it:

if exist D:\Test1\LOCK.TXT echo %DATE% %TIME% LOCKBOX.txt file found > LOCKBOX_LOG.txt

I am pretty certain your error message is not coming from that code. I see nothing wrong with it.

Hradschek
Posts: 10
Joined: 03 Apr 2016 12:39
Location: Germany

Re: Writing Date and Time to a log file

#3 Post by Hradschek » 04 Apr 2016 13:44

I agree with Squashman. There is no mistake in it.

bmurtha
Posts: 4
Joined: 17 Nov 2015 13:47

Re: Writing Date and Time to a log file

#4 Post by bmurtha » 05 Apr 2016 07:50

Thanks for the help,

I was writing to an AS/400 share, it was throwing the error because the file name was more than 8 characters.

Thanks again,
Regards,
Bryan

Post Reply