Finding Firefox
I was trying to write an AutoIT script to manipulate the Firefox user.js preferences files, which are stored in the users’ Firefox profile folders. Unfortunately with Firefox, the initial user profile is created in a “salted” directory under %appdata%\Mozilla\Firefox\Profiles. The folder name uses a randomly generated 8-character string followed by a dot and the word default, like this: df3etnz3.default. This can make scripting modifications of the user preferences a real pain in the ass, as you can’t be sure what the name of the user profile folder is.
Fortunately, there’s a file named profiles.ini in %appdata%\Mozilla\Firefox that lists the folder name, so we can pull the information from there. The initial profile will be listed on line 7 of the profiles.ini so:
; Find the Firefox user profile $file = FileOpen(@AppDataDir & "\Mozilla\Firefox\profiles.ini", 0)
; Extract the raw profile path $rawpath = FileReadLine($file, 7) FileClose($file)
; Extract the actual Firefox profile directory $mozfolder = StringRight($rawpath, 16)
; Create Profile Path variable $mozpath = @AppDataDir & "\Mozilla\Firefox\Profiles\" & $mozfolder
Now you can just reference the profile path using $mozpath.






