batch script to delete and replace files in multiple locations


What I am looking to do is create a batch file to replace teh cert8.db file in a users application data folder as well as insert a line of text into one of the prefs.js file. Normally this would be easy, the issue is that there is a good chance some of my users have multiple firefox profiles so I would like to have a script to to replace all cert8.db files in the firefox/profiles folder and insert 1 line of next into all prefs.js files in the firefox/profiles folder.

Can this be done? I am willing to use vb if possible.

You could do something like this:

Set fso = CreateObject("Scripting.FileSystemObject")

profilesFolder  = "C:\Users"
firefoxProfiles = "AppData\Roaming\Mozilla\Firefox\Profiles"

For Each fldr In fso.GetFolder(profilesFolder)
  profilePath = fso.BuildPath(fldr.Path, firefoxAppdata)
  If fso.FolderExists(profilePath) Then
    For Each profile In fso.GetFolder(profilePath)
      certdb = fso.BuildPath(profile, "cert8.db")
      prefs  = fso.BuildPath(profile, "prefs.js")

      If fso.FileExists(certdb) Then
        'replace cert8.db
      End If

      If fso.FileExists(prefs) Then
        'modify prefs.js
      End If
  End If

The code for replacing the DB file and modifying the preferences depends on where the replacement DB comes from and what you want to add or update in the preferences.