Computing Staff
  • 0

Bat/Script File To Set Homepage

  • 0

So I am trying to create a .bat file that i can store on the server, run it, and it sets the IE, Chrome and Firefox homepages all at the same time. I have hundreds of computers to set and i REALLY dont want to have to do them all manually. I would be open to a script as well. I found out how to add a registry key for IE to be set, but i cant figure out chrome of firefox

Share

2 Answers

  1. 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 mentioned:

    @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%

    In Google chrome:

    chrome settings are in %USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data.ChromotingConfig.json and are a little bit encrypted as npocmaka mentioned.

    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/’;})();

    • 0