Running exiftool from Windows GUI

Started by brgmx5, June 16, 2019, 06:38:59 AM

Previous topic - Next topic

brgmx5

This is a programming question really; if this is the wrong place for it, please move it or tell me where I should post it.

I've been trying to knock up a Windows 10 compatible front end for exiftool, inspired by and very much along the lines of Bogdan's ExiftoolGUI.  Reasons are that ExiftoolGUI hasn't been maintained for quite a while now, it is flaky on Win10, and I thought I could add a few features I use that ExiftoolGUI doesn't support.

I'm using C# in Visual Studio 2017 and dot NET framework 4.5.2.  I'm running exiftool stand-alone Windows executable ver 11.51.  I launch this from the C# code using the System.Diagnostics.Process.Start() method.  The StartInfo parameters are UseShellExecute = false; RedirectStandardOutput = true; CreateNoWindow = true.

This works fine if all I'm trying to do is read stuff, but if I try to do anything that would cause a write (delete/add/modify tags) then nothing happens.  If I run the program in the VS17 debug environment, a message appears in the Output window saying "Error renaming <target>".  The '\' separator characters have been replaced by '/' characters in the quoted target's path, so probably this message is coming somehow from the launched process.  If I try to get around this using the  -overwrite_original option, then the message simply becomes "Error opening <target> for writing".  So it appears to be a permissions problem.

I'm not an expert in any of this.  I don't know what permissions the exiftool process gets started with, and googling hasn't helped me find out.  I have fiddled with the file permissions, but nothing seems to work.  I'm stuck, and puzzled because I use a similar technique in another program which launches Robocopy.exe, and that copies stuff all over the place with no problems.  So maybe it has something to do with the way exiftool/Perl do their file handling?  Is there a clue in the '/' characters?

Could anyone suggest how I should start the exiftool process, or how the target file permissions should be set?

Phil Harvey

Yes, definitely some sort of permission problem, but I can't suggest a fix, other than looking at the exiftool.exe Properties to see if changing them helps.

The forward slashes are unrelated to this problem, but they do indicate that the error message is coming from ExifTool because it converts all backslashes to forward slashes.

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

brgmx5

Phil

Thanks for your quick reply, but I'd already been into the exiftool.exe properties.  All users there are set to full control.

I made the minimum possible hacks to my Robocopy.exe launcher prog to launch exiftool instead.  It doesn't work, not even for reading.  I've tried doing it from VB instead, in case the generally simpler VB environment sets up some defaults I don't know about.  No joy.

There must be something different about the way exiftool is built that means it can't be run this way from .net.  But I don't have the knowledge nor the diagnostics to figure out what that is.  Unless anyone else has some suggestions, I will have to abandon this project.

Phil Harvey

Maybe read this thread for an alternate way to run exiftool.

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

obetz

brgmx5, did you test the "unpacked" ExifTool already mentioned by Phil?

If you didn't get it already from my web site, I posted today the current version also in the other thread today.

Please report your findings and/or let me know if you have any problems with it.

Oliver

brgmx5

Oliver

Thank you for your reply.  I did look through your webpage when Phil referred me to it, and I have d'ld your ppl.zip, but there's quite a bit I don't currently understand.  That's down to my ignorance, not your explanations.  Although I'm an old programmer, I have very little Perl in my background, and none of what little I have done was on Windows.  I would have to do a lot of background reading to get up to speed, and due to my personal circumstances these days (which I've outlined in a private email to Phil) that might or might not be feasible.

Do you have any reason for thinking that your unpacking approach would solve the apparent permissions problem that I've encountered, and which I can't fully characterise?  If so, that might give me more of a motivation to get stuck into it.

obetz

Quote from: brgmx5 on June 19, 2019, 10:34:53 AM
Do you have any reason for thinking that your unpacking approach would solve the apparent permissions problem that I've encountered, and which I can't fully characterise?

Not more than I wrote before: Running executables in temp is considered suspicious by many AV products and even might be blocked by system policies.

it's not that likely it'll solve your problem, but if you want to try, look here: https://exiftool.org/forum/index.php/topic,10128.msg53384.html#msg53384 There is a short description and a link to an installer resp. archive.

Oliver


jean

Hello
I am the author of Metadata++, a (free) GUI for Exiftool.
I use exifttol with -stay-open or by calling it directly with arguments. (VC++ 2017 and 2019)
I will be happy to try to resolve problems if they always exist.
Jean

gkinney

Hello Jean,

I am having this same issue with VB.NET, can you post a snippet of your writing function? I may need to try that route. Thanks!