2
I've prepared a number of video files that will each have their own HTML page. (I'm making a series of lecture videos and trying to keep things simple since I'm a chemist, not a coder.)
I'd like to set up a command at the Windows (v.7) command line that I can copy/paste into the window and have it:
- find all MP4 files in the directory
- create an HTML file with the same name (without the extension)
- 'fill' this HTML file with the template HTML
I'm aware that all these can probably be accomplished in one step, but I don't mind being less elegant – CPU cycles aren't 'expensive' in this case. One example of the filenames is: 11-a - Ion Dipole Interactions.mp4
in case that's helpful.
Here's what I have so far, and how it's breaking. Any ideas on how to make it work?
for %G in (*.mp4) do (copy /Y nul "%nG".html)
i.e. scan the directory for MP4s, then make 0 byte HTMLs with the same name.
for %I in (**.*mp4) do (ECHO %~nI)
gives me the right filename, but the command listed just keeps giving me thefilename %nG.html
for %G in (*.html) do (type SHORT.html>"%G".html)
SHORT.html
is my template-form HTML. I can think of two approaches but can't get either to work:- copy SHORT paste with the final filename for all the MP4s
- make the HTMLs, then pipe the text of
SHORT
into each.
I'm ok with other approaches too, but please be option-explicit in your description!
Obviously, neither has worked so far.
1Hi Kevin! Please post your answer below using the Answer your question button once the system allows you to (should be in about 7hrs). That way you can accept it later and others can vote on it as well. Thanks! By the way, I cleaned up your formatting a little. Click [edit] to see what changes I made to the code so it's formatted as such. – slhck – 2013-05-28T14:56:09.123
Thanks for the fixes! I'll try to come back to this tomorrow and switch to Answer your Question. – Kevin Davies – 2013-05-28T14:59:01.900