I am trying to automate with a very simple batch file the editing of PDF titles. I want to be able to drag and drop a series of files and have cmd run exiftool for each one. After running the command, I wanted to display a message asking whether the edit went succesfully or not, in the first case I would delete the _original backup files created form exiftools and in the second case I would restore them. This is what I wrote:
:renaming
if "%~1" == "" goto:done
"C:\Users\Alessio\Desktop\Programmazione\Exiftools\exiftool.exe" "-title<${filename;s/.[^.]*$//}" "%~1"
shift
goto:renaming
:deleteOriginals
if "%~1" == "" goto:end
"C:\Users\Alessio\Desktop\Programmazione\Exiftools\exiftool.exe" -restore_original "%~1"
shift
goto:deleteOriginals
:restoreOriginals
if "%~1" == "" goto:end
"C:\Users\Alessio\Desktop\Programmazione\Exiftools\exiftool.exe" -delete_original "%~1"
shift
goto:restoreOriginals
:done
shift /1
choice /C YN /M "I file sono stati rinominati correttamente?" && goto:deleteOriginals || goto:restoreOriginals
:end
pause
It appears that once I cycle once through the parameters that I got from the drag and drop, I can't just call shift /%1 to go back to the start. How would I do this? I tried to fiddle around with the set command with little luck. If batch isn't able to do this I was thinking that maybe I could have exiftool create a text file with all the paths and have the cmd load the arguments from there and delete it in the end. Thanks in advance