I have enabled a “convert to JPG” alternative in my Windows context menu. To do this, I programmed the context menu to execute the command “magick convert %1 %1.jpg“. Although this approach functions, it retains the initial file extension, resulting in a file named “TestImage.png.jpg” instead of “TestImage.jpg“.

I desire to remove the original file extension and have the output file named simply “TestImage.jpg“.

However, I believe that utilizing variables like %~n1 will only work in a batch script’s FOR block.

Is there any other solution available, or am I taking the wrong approach?

Thank you very much.

Askify Moderator Edited question April 28, 2023