Converted command to a .BAT file

Started by terrypin, March 20, 2013, 04:48:41 PM

Previous topic - Next topic

terrypin

After much help here I succeeded in writing a text file showing selected metadata for a folder of photos. I did it using Phil's instructions as follows: opening a Command Prompt in XP, typing 'exiftool', <space>, and then the rest. The full line looks like this:

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

But rather than open a Command Prompt I wanted to execute that via a shortcut or a batch file. I tried a one-line BAT file containing exactly the line above. It did write C:\Docs\My Pictures\PHOTOS\Tests\Comments.txt - but it was empty. So after some googling I  thought I'd try simply renaming that one-liner from ExifTool-WriteComments.BAT to
ExifTool-WriteComments.CMD. And it worked!

Is that OK? Or are there some side issues that might bite me later?

--
Terry, East Grinstead, UK

Tarn

Hi Terry,

That should be fine, especially if it works. As I understand it *.bat, *.cmd, and *.nt files all do the same thing, just different extensions.

Phil, or anyone, please feel free to  correct me or expand on this.

Phil Harvey

That's a new one for me.  I thought Windows batch files were all .BAT

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

terrypin

#3
Hi Phil, Tarn,

My main aim is to get a few specific commands working from shortcuts. But when I get some time to re-learn a bit about batch and command files I aim to study this page:


http://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd

--
Terry, East Grinstead, UK

Tarn

Quote from: terrypin on March 21, 2013, 03:17:22 AM
Hi Phil, Tarn,

My main aim is to get a few specific commands working from shortcuts. But when I get some time to re-learn a bit about batch and command files I aim to study this page:


http://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd

--

Terry, East Grinstead, UK
Good read. Boring, but good.
:)