title: How to find and replace text strings in multiple files using VBScript
body: <p>I have a basic question about a simple VBScript. My goal is to find a replace multiple text strings in multiple files.  (The 21 text strings to replace are the same across files.)  The file names have about 12 prefixes and then will have numbers 1 to 200 at the end.  The code I am using for just one of the strings in one of the files is as follows.</p>
  <pre><code>Const ForReading = 1
  Const ForWriting = 2
  
  Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
  Set objFile = objFSO.OpenTextFile(&quot;C:\filename_XX.txt&quot;, ForReading)
  
  strText = objFile.ReadAll
  objFile.Close
  strNewText = Replace(strText, &quot;Test 1&quot;, &quot;Test 2&quot;)
  
  Set objFile = objFSO.OpenTextFile(&quot;C:\filename_XX.txt&quot;, ForWriting)
  objFile.Write strNewText
  objFile.Close
  </code></pre>
  <p>I just want to loop over the file names and possibly loop over the search strings.  Could a For...Next loop accomplish this?  Can I refer to the number of the for loop in the filename object?</p>
  <p>I have seen a response about searching over subfolders, but I think it is more sophisticated than what I need to do.</p>