Hi Igor,
I've somehow lost the track of this thread... so I've read it completelly again -as I have a feeling, I tend to repeat things :-).
To your batch file first. I didn't go thru it line by line, but it does makes sense... so, I've copied it and tried. Haven't tried all possible combinations, but in case you rotate (inside DPP) Horizontal taken image to the right and convert, then above batch has problems (it runs in endless loop) -but that can be solved, though.
Now, what I did (again)... I took two CR2 examples: one horizontal and one vertikal taken photo. I've opened those two inside DPP, where I rotated both in right direction and converted to JPG.
Then I've made a simple (big) "signature" on both JPG images (using Corel PSP), so I can easy identify them as "edited preview". Now, using GUI, I imported both jpg images back into CR2.
When doing this, GUI alerted me (with reason), that one of both has "wrong" orientation. Because I knew, this has nothing to do with actual camera orientation (it was DPP), I didn't choosed "Rotate now" button. I just clicked on "Embed" button (meaning: let GUI decide what to do).
And it did as expected: when using viewer (fastone), CR2 orientation is the same as when seen inside DPP -and that was the goal, IMO.
Of course, when you again extract jpg preview from CR2 (without exif data), then orientation of extracted jpg will be wrong -that's why I've made menu "Options>Copy Exif when extract JPG from CR2".
As said, I didn't go thru all possible combinations, still I believe, in general, GUI does what I was trying to accomplish.
Thumbnail issue... To be honest, the only tool (I know of) which uses thumbnails inside CR2, is IrfanView. I would bother (after all, IrfanView is well known), but after changing jpg preview inside CR2, IrfanView has some troubles showing thumbnail anyway (all I could see, was "black" thumbnail).
The thing is (as I see it), today's PC's are very fast and can show previews as thumbnails on the fly -I've never missed thumbnails, so to speak.
Back to your solution. Yes, I agree, the way you think of, is probably most complete (when finished). The problem I see, is speed: for each image, exiftool and nconvert are called several times...
There's another thing you probably didn't notice: if jpg image (you wish to import) contains metadata, then complete metadata will be again imported into CR2 file. Meaning, added metadata resides (as duplicate) inside jpg preview section -just takes space, though.
That's it. Anyway, I see you didn't give up on this. That's good, really -just keep on.
Greetings,
Bogdan