Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>cd /D "%APPDATA%\Mozilla\Firefox\Profiles" cd *.default set ffile=%cd% echo user_pref("network.proxy.http", "%1");>>"%ffile%\prefs.js" echo user_pref("network.proxy.http_port", 3128);>>"%ffile%\prefs.js" echo user_pref("network.proxy.type", 1);>>"%ffile%\prefs.js" set ffile= cd %windir%</p> </blockquote> <p>This is nice ! Thanks for writing this. I needed this exact piece of code for Windows. My goal was to do this by learning to do it with Linux first and then learn the Windows shell which I was not happy about having to do so you saved me some time!</p> <p>My Linux version is at the bottom of this post. I've been experimenting with which file to insert the prefs into. It seems picky. First I tried in ~/.mozilla/firefox/*.default/prefs.js but it didn't load very well. The about:config screen never showed my changes. Currently I've been trying to edit the actual Firefox defaults file. If someone has the knowledge off the top of their head could they rewrite the Windows code to only add the lines if they're not already in there? I have no idead how to do sed/awk stuff in Windows without installing Cygwin first. </p> <p>The only change I was able to make to the Windows scripts is above in the quoted part. I change the IP to %1 so when you call the script from the command line you can give it an option instead of having to change the file. </p> <pre><code>#!/bin/bash version="`firefox -v | awk '{print substr($3,1,3)}'`" echo $version " is the version." # Insert an ip into firefox for the proxy if there isn't one if ! grep network.proxy.http /etc/firefox-$version/pref/firefox.js then echo 'pref("network.proxy.http", "'"$1"'")";' &gt;&gt; /etc/firefox-$version/pref/firefox.js fi # Even if there is change it to what we want sed -i s/^.*network.proxy.http\".*$/'pref("network.proxy.http", "'"$1"')";'/ /etc/firefox-$version/pref/firefox.js # Set the port if ! grep network.proxy.http_port /etc/firefox-$version/pref/firefox.js then echo 'pref("network.proxy.http_port", 9980);' &gt;&gt; /etc/firefox-$version/pref/firefox.js else sed -i s/^.*network.proxy.http_port.*$/'pref("network.proxy.http_port", 9980);'/ /etc/firefox-$version/pref/firefox.js fi # Turn on the proxy if ! grep network.proxy.type /etc/firefox-$version/pref/firefox.js then echo 'pref("network.proxy.type", 1);' &gt;&gt; /etc/firefox-$version/pref/firefox.js else sed -i s/^.*network.proxy.type.*$/'pref("network.proxy.type", 1)";'/ /etc/firefox-$version/pref/firefox.js fi </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload