How would I go about modifying Firefox's about:config settings via an external .bat file?

6,601

The comments in the prefs.js file:

# Mozilla User Preferences

/* Do not edit this file.
 *
 * If you make changes to this file while the application is running,
 * the changes will be overwritten when the application exits.
 *
 * To make a manual change to preferences, you can visit the URL about:config
 * For more information, see http://www.mozilla.org/unix/customizing.html#prefs
 */

That said, you should be able to edit the file with the application closed, and the new settings would take effect when it is launched.

Depending on what setting(s) you want to modify, however: I don't believe the registry or command-line options will get you the same settings. Registry settings are more system-specific and not per-user; and command-line parameters will give you specific instance switches for the application, such as window size and which profiles to load, etc.

If you know the specific setting you want to change, you could search for it in the prefs.js file with a regex (using VBScript would be my choice) write a new file with the replacement setting, then rename/delete files so that the new prefs.js replaces the previous one.

Share:
6,601

Related videos on Youtube

Matt Refghi
Author by

Matt Refghi

Developer, Blogger, Interviewer, Technical Writer and Social Media Guy. Despite my vegetarian diet, I could probably last a few seconds against a Grizzly bear.

Updated on September 17, 2022

Comments

  • Matt Refghi
    Matt Refghi over 1 year

    I would like to change the value of a particular about:config property via a script external to Firefox.

    Have any of you tried this before? I've read that you can modify "prefs.js", but I was wondering if there was a simpler, more correct approach. For example, maybe a:

    • command-line argument to the Firefox executable (a batch file would work in this case)
    • a registry setting (a .reg file would work)
    • Matt Refghi
      Matt Refghi almost 15 years
      Hmm... should this be on StackOverflow instead?
    • Ciro Santilli Путлер Капут 六四事
      Ciro Santilli Путлер Капут 六四事 almost 8 years
  • Rublacava
    Rublacava over 3 years
    The above post was made in 2009. In 2020 in Windows 7 the "prefs.js" file is in "%APPDATA%\Mozilla\Firefox\Profiles\" then go to a folder which looks like "0om18h5n.default\" and you will see prefs.js.