Firefox Proxy Settings via command line

Posted on 2009-04-21
Last Modified: 2013-12-07
Is there a way to set Firefox Proxy settings via command line? I am on XP workstations.
Question by:Pete
    LVL 35

    Accepted Solution

    There is no documented way to start Firefox from the command line with a switch for using a specific proxy - if that is what you mean.

    You may, however, very well edit the proxy settings from the command line, since they are stored inside "prefs.js", a simple text file located in the user's Mozilla profile folder. The only problem here is the fact that Windows XP does not come with a command line text editor, you would have to 'import' from a Win2k machine.

    But I see you are looking into this for the sake of batch scripting.
    A possible way to go about this in a batch file might be to store several modified files, one for each proxy you need to use, and to rename them to prefs.js before calling Firefox.
    LVL 1

    Author Comment

    OK, great I can see the relevant entries in prefs.js but the path to it is quite unusual
    C:\Documents and Settings\Pete\Application Data\Mozilla\Firefox\Profiles\po2piqae.default
    The  'po2piqae.default' part seems to be random, so how can I force (xcopy or something) my choosen pefs.js into that path if it's different on every machine, or will it be the same path?
    LVL 1

    Author Comment

    nearly there I have my prefs.js on C:\ but as far as scripting it goes:

    xcopy C:\prefs.js "C:\Documents and Settings\Pete\Application Data\Mozilla\Firefox\Profiles\po2piqae.default" /q /y
    works fine..but using a wildcard *:
    xcopy C:\prefs.js "C:\Documents and Settings\Pete\Application Data\Mozilla\Firefox\Profiles\*.default" /q /y
    says 1 file copied but it doesn't appear, what's going on?

    LVL 35

    Expert Comment

    Sorry, my internet connection was down for 2 hours.

    You got it, profile names always have the ".default" extension. I'd not be too certain that wildcards in path names should work though, especially not when provided within quotation marks.

    I think you will have to extract (or pipe) the actual profile name from the \profile directory listing somehow. Unfortunately, my experience in batch file scriptinmg is limited.
    LVL 7

    Expert Comment

    Is this a one of setup of alot of computers or do you need them to be able to switch between proxies?

    Are you in a domain enviroment? If so, you could look at using the firefox .adm file to configure settings in group policy

    More Information here

    or google it here

    You could also look at using the adm on the local security policy if you are not in a domain enviroment. You could them simple take the security policy to each station and install it, or use batch scripting to do it.


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
    Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
    Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
    This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now