The easiest way to do this is to configure your Firefox to use a PAC with a file URL, and then change the file URL from the line command before you start Firefox.
This is the easiest way. You don't have to write a script that remembers what path to prefs.js is (which might change over time).
You configure your profile once, and then you edit the external file whenever you want.