Batch file search and replace using wildcards?

Posted by user329358 on Stack Overflow See other posts from Stack Overflow or by user329358
Published on 2010-04-30T00:29:33Z Indexed on 2010/04/30 0:37 UTC
Read the original article Hit count: 262

Filed under:

Batch file search and replace using wildcards

I have a html (txt) file I am using as a template or sourcefile to create further html files.  Filename = pg_0001.htm and it contains a line of code thus:

pg_0001.jpg

I want to parse the pg_0001.htm sourcefile, increment and replace the jpeg string, like this:  "pg_0002.jpg", and then output the edited htm file to a new filename pg_0002.htm

I then take each newly created file (pg_0002.htm, pg_0003.htm etc) as the sourcefile and repeat the processing until I have reached my target goal (let's say 100 newly created htm files containing code to display the corresponding jpeg.

It must be done this way (fileX.htm containing fileX.jpg) because there is other javascript that uses these incremented filenames as function input.

I used to know how to write incrementing batch files many years ago but I'm old & very rusty now.  Can anyone please help me do this?  Many thanks in advance.

regards Harry

© Stack Overflow or respective owner

Related posts about JavaScript