Quirky behaviour of batch file

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?
 
B

Ben Myers

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
 
T

Terry Pinnell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top