Command line script with loop and regex

January 26, 2011 at 23:57:01
Specs: Windows 7
I'd like to process all the .mov files in a directory with a command that has this structure:

mkvmerge -o 293497.mkv -d 7

This is as far as I've got, but it's not right:

for %m in (./*.mov); do set mkvfile="$(echo %m | sed 's/mov/mkv/')"; mkvmerge -o $mkvfile -d 7 %m; done

What command can accomplish this?


See More: Command line script with loop and regex

Report •

January 27, 2011 at 00:21:45
I'm assuming this is windows cmd scripting because it's in batch with windows 7 listed. The syntax looks more bash like so I'm guessing that's your background.....

If I'm wrong just ignore my post and clarify your environment.

Try this out and see if the names look right(I prefixed with echo).

for %%m in (*.mov) do echo mkvmerge -o "%%~dpn.mkv" -d 7 "%%~fm"

If you do it from the prompt instead of a script reduce the percentage signs from two to one.

Report •
Related Solutions

Ask Question