Instead of a batch file it may be easier to create a VBS script (saved to the PC's startup folder) and use the registry to maintain the count:
For example, a VBS script would need to:
1) Check for the existence of a file (using the FileExists method of the FileSystemObject).
2) If the file exists then go to 6 below or, if the file does not exist, create a file (using the CreateTextFile method).
3) Open the file for writing (using the OpenTextFile method) and write the date and time, a space or tab then the figure 1 then a new line.
4) Close the file for writing.
5) Write the value 1 to the registry (using the RegWrite method of the WshShell object) then exit the script.
6) Check for the existence of or just read the value of the registry key (using the RegRead method), increment it by 1 and write the value back to the registry.
7) Open the file for appending.
8) Write the date and time, a space or tab then the value from the registry then a new line
9) Close the file for writing and exit the script.
You can find examples of how to use all these methods in Tek-Tips' VBScript forum.
Have a look at
for more examples of the RegWrite and RegRead methods.
Have a look at
for more examples of using the FileSystemOject.
For the date and time in the format you want you can use:
Code:
strDateTime = date()& " " & time()
Hope this helps...