Reputation: 13
I've been looking for how to do this but failed.
I want a batch file to change the homepage for all my browsers (IE, Firefox and Chrome) at the same time may be?
I hope I can help, thanks!
Upvotes: 1
Views: 4692
Reputation: 8312
In Internet Explorer:
you can do that like below:
REG ADD "HKCU\Software\Microsoft\Internet Explorer\Main" /V "Start Page" /D "http://www.google.com/" /F
In Firefox:
FF uses a JavaScript (prefs.js in your FireFox User Profile) and not a Registry entry.
What you will need to do is programmatically edit the prefs.js file in the user profile for Firefox found in the directory C:\Users\ [USERNAME]\AppData\Roaming\Mozilla\Firefox\Profiles\ [Subfolder]
You will need to add or edit the line that looks like: user_pref("browser.startup.homepage", "www.google.com"); as:
@Echo off
taskkill /im firefox.exe* /f
cd /D "%APPDATA%\Mozilla\Firefox\Profiles"
cd *.default
set ffile=%cd%
echo user_pref("browser.startup.homepage", "https://www.google.com");>>"%ffile%\prefs.js"
set ffile=
cd %windir%
Another option using JavaScript is:
You can change the Firefox homepage by setting the preference "browser.startup.homepage"
The easiest way to do this in an add-on via JavaScript is:
Components.utils.import("resource://gre/modules/Services.jsm");
Services.prefs.setCharPref("browser.startup.homepage", "http://www.google.com");
In Google chrome:
chrome settings are in %USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data.ChromotingConfig.json and are a little bit encrypted.
but you can do a workaround like by just pasting following javascript into the "Home Page" pref field (under your Chrome options) and it works as expected when clicking the "Home" button.
javascript:(function(){ window.location.href='http://www.google.com/';})();
Upvotes: 0
Reputation: 11
Create a Batch file with
REG ADD "HKCU\SOFTWARE\MICROSOFT\INTERNET EXPLORER\MAIN" /V "START PAGE" /D "https://google.com/" /F
Double click it will make homepage in Internet explorer
Upvotes: 1