Batch Files: Can you do this...

MangoTBG

Diamond Member
Apr 28, 2003
3,101
0
76
I think this is the appropriate forum...anyways.

Can you create a batch file so it opens all .html files in a directory w/ notepad and then Find/Replace a specific word/phrase with something else?

It seems like that'd be a complicated task, but could a batch file be created to do such a thing?
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
I don't think notepad provides the kind of automation you're looking for. There are, however many ways of replacing text in a file without opening it in Notepad. Most scripting languages will be able to do this pretty easily.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
You won't be able to do it with notepad, but you can do it with Word if you so choose. Look at my reply in this thread regarding automating the processing of Word docs with a macro. Do you have word? You could record a macro to perform the find/replace, and you could use the same method I described to process each file in the manner.

Personally, I would again use Perl, sed, or something similar to simply to a regular expression substitution. As oog said, pretty much any language could accomplish the same thing; however, I'm assuming that you're not familiar otherwise you would choose that over a batch file. If you wish to go the Perl/sed/whatever route instead of the Word macro route, let me know and I'll throw some examples your way.
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
I think a VBscript guy would be able to do this in a jiffy. I'm not so keep on looking! :)