I have created a simple batch file to record user logons and output the results to a csv file.
When I run the file, it gathers the information correctly and creates the csv file but the csv is empty.
By putting a pause into the batch file I can see that it is trying to interpret the first part of the output as a command and failing, but I can't understand why it is doing it.
The batch file is:
echo
%date%,%username%,%computername% >>C:\logons.csv
pause
On running the batch file, the output is:
22/03/2010,user1,pc1
'22' is not recognised as an internal or external command.
As you can see, the output data/variables are as expected and the logons.csv file is created, but it can't write the data to the file as it seems to think that the '22' from the date is a command.
Any ideas what is causing this?
Thanks