批处理文件来设置主页在所有浏览器 [英] Batch file to set homepage in all browsers

查看:1823
本文介绍了批处理文件来设置主页在所有浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找如何做到这一点,但失败了。

我想一个批处理文件来在同一时间更改为我所有的浏览器(IE,Firefox和Chrome)首页应?

我需要code键使该文件。

我已经做了这样的..但不成功。

 关闭@echo
REG ADDHKCU \\ SOFTWARE \\ MICROSOFT \\ INTERNET EXPLORER \\ MAIN/ V开始页/ Dhttp://www.google.com//˚F
关闭@echo
REG ADDHKCU \\ SOFTWARE \\ MICROSOFT \\ Google Chrome浏览器\\ MAIN/ V开始页/ Dhttp://www.google.com//˚F
关闭@echo
REG ADDHKCU \\ SOFTWARE \\ MICROSOFT \\ Mozilla Firefox的\\ MAIN/ V开始页/ Dhttp://www.google.com//˚F


解决方案

在Internet Explorer中:

您可以这样做如下:

  REG ADDHKCU \\软件\\微软\\的Internet Explorer \\ MAIN/ V起始页/ Dhttp://www.google.com//˚F

在Firefox中:

FF使用一个JavaScript($ P $在Firefox的用户配置文件pfs.js),而不是一个注册表项。

您需要做的就是编程编辑用于Firefox的用户配置文件prefs.js文件在什么目录C发现:\\用户\\ [用户​​名] \\应用程序数据\\漫游\\ Mozilla的\\火狐\\ Profiles文件\\ [子文件夹]

您将需要添加或编辑看起来像行:用户_ preF(browser.startup.homepage,www.google.com);如前所述:

  @回响
TASKKILL / IM firefox.exe * /˚FCD / D%APPDATA%\\ Mozilla的\\火狐\\配置文件
CD * .DEFAULT
设置ffile的=%CD%
回声用户_ preF(browser.startup.homepage,https://www.google.com);>>中%ffile的%\\ prefs.js
设置ffile的=
CD%WINDIR%

使用JavaScript的另一个选项是:

您可以通过设置preference改变火狐主页browser.startup.homepage

在一个插件通过JavaScript执行此操作的最简单方法是:

  Components.utils.import(资源://gre/modules/Services.jsm);服务prefs.setChar preF(browser.startup.homepage,http://www.google.com);

谷歌浏览器:

Chrome浏览器设置在%USERPROFILE%\\本地设置\\应用数据\\谷歌\\铬\\用户Data.ChromotingConfig.json并一点点加密为npocmaka提及。

但你可以做到像刚刚粘贴下面的JavaScript进入主页preF场(在你的浏览器选项),一个解决办法,并点击主页按钮时,按预期工作。

 的javascript:(函数(){window.location.href =HTTP://www.google.com/';})();

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 need code to make this file..

I have done Like this.. but in vain.

@echo off
REG ADD "HKCU\SOFTWARE\MICROSOFT\INTERNET EXPLORER\MAIN" /V "START PAGE" /D "http://www.google.com/" /F 
@echo off
REG ADD "HKCU\SOFTWARE\MICROSOFT\GOOGLE CHROME\MAIN" /V "START PAGE" /D "http://www.google.com/" /F 
@echo off
REG ADD "HKCU\SOFTWARE\MICROSOFT\MOZILLA FIREFOX\MAIN" /V "START PAGE" /D "http://www.google.com/" /F 

解决方案

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%

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

这篇关于批处理文件来设置主页在所有浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆