Drag and drop files onto batch script to add file extension #

Appends ".jpg" to files dragged and dropped onto the saved script's icon:

@echo on
for %%I in (%*) do ren %%I "%%~nI.jpg"
pause

From Microsoft's 'for' documentation:

Simple, but perhaps a trifle cavalier, without any sanity checks or filetype awareness. By leveraging exiftool, we can improve on things a bit:

@echo on
for %%I in (%*) do exiftool.exe "-filename<$filename.$filetypeextension" -r -ext . %%I
pause

H/T:

/windows | Nov 20, 2021


Subscribe or visit the archives.