Quirky behaviour of batch file

  • Thread starter Thread starter Terry Pinnell
  • Start date Start date
T

Terry Pinnell

This seems very odd. I wrote a 1 line batch file to write a file
Comments.txt containing data about JPG files in a source folder.

exiftool -T -filename -datetimeoriginal -comment "C:\Docs\My
Pictures\PHOTOS\Tests" > "C:\Docs\My Pictures\PHOTOS\Tests\Comments.txt"

It did so, but the file was empty. I had sound reasons for believing the
command was correct. In particulatr a similar batch file had worked OK
earlier. The only difference was that it had a REM line as well. So as a
longshot I changed the new batch file by adding the line
REM

.... and it worked!

I then removed the REM, re-saved ... and it still worked.

Anyone have any ideas about this puzzling behaviour please?
 
Terry Pinnell said:
This seems very odd. I wrote a 1 line batch file to write a file
Comments.txt containing data about JPG files in a source folder.
exiftool -T -filename -datetimeoriginal -comment "C:\Docs\My
Pictures\PHOTOS\Tests" > "C:\Docs\My Pictures\PHOTOS\Tests\Comments.txt"
It did so, but the file was empty. I had sound reasons for believing the
command was correct. In particulatr a similar batch file had worked OK
earlier. The only difference was that it had a REM line as well. So as a
longshot I changed the new batch file by adding the line
REM
... and it worked!
I then removed the REM, re-saved ... and it still worked.
Anyone have any ideas about this puzzling behaviour please?

One possibility is a text editor that doesn't automatically add a carriage return
and line feed at the end of a line.

Ben
 
Ben Myers said:
One possibility is a text editor that doesn't automatically add a carriage return
and line feed at the end of a line.

Ben

Thanks, Ben, exactly right! I added a CRLF and it worked fine.
 
Back
Top