I am trying to convert files (movies) in a directory, one by one. Each new, converted file needs a new file name assigned - the old one with a new extension.
I've tried the below to read the source file, strip off the extension and assign a new one:
@echo off
setlocal DisableDelayedExpansion
cd \target_dir
for %%x in (*) do (
echo %%x
set source=%%x
echo Source #%source%#
set target=%source:.mpg=%
echo Target #%target%#
transcode %source% %target%.mp4
)
Unfortunately, this is not working. As the output shows, I am not even managing to copy the current file into the variable "source":
E:\target_dir>..\test.bat
movie1.mpg
source ##
target ##
movie2.mpg
source ##
target ##
I googled around and thought I'd have found the right syntax, but that doesn't appear to be it. Thanks for any help!