스크립트를 통해 Firefox를 구성하려면 어떻게합니까? 배치)를 통해 다음 Firefox 설정을 구성하려고합니다. 기본 홈페이지 기본

스크립트 (VBS 또는 배치)를 통해 다음 Firefox 설정을 구성하려고합니다.

  • 기본 홈페이지
  • 기본 검색 엔진
  • 자동 업데이트 비활성화

이것이 가능한가?



답변

선호하는 스크립팅 언어로 Mozilla 환경 설정 파일작성하거나 조작 하여이를 수행 할 수 있습니다.

이러한 파일을 통해 설정할 수있는 환경 설정 목록은 목록에 해당하는 Mozilla 환경 설정about : config 설명서를 참조하십시오 .

  • browser.startup.homepage (기본 홈페이지)
  • browser.search.defaultenginename (기본 검색 엔진)
  • app.update.auto (자동 업데이트 활성화 / 비활성화)

그러나 환경에 따라 사용자 지정 애드온 ( Mozilla 환경 설정 안내서 의 XPI 설명 참조 ) 또는 FirefoxADM 또는 이와 유사한 GPO를 통해 설정을 푸시하는 것이 좋습니다 .


답변

사용자 프로파일 폴더의 user.js 파일에서 개인용 브라우저 옵션을 대체 할 수 있습니다. 파이프 라인과 같은 일부 옵션을 재정의하는 데 자주 사용합니다. user.js를 업데이트 한 후 Firefox를 다시 시작해야합니다. user.js 파일이 존재하지 않으면 파일을 만들어야합니다.


답변

내가 찾던 답변의 일부를 문자 그대로 복사 / 붙여 넣기 (win env.)

'C:\Users\User\AppData\Roaming\Mozilla\Firefox\Profiles\#####.default\prefs.js'

더하다

user_pref("browser.startup.homepage", "http://www.URL");

Get-Content / cat string.txt / “String”>> 경로를 사용하여 원격 컴퓨터에 복사하려는 시도 prefs.js는 문자열의 이스케이프 문자로 인해 파일에 가비지가 삽입되어 종료되었습니다 .


답변

cd /D "%APPDATA%\Mozilla\Firefox\Profiles\*.default"

set ffile=%cd%

echo user_pref("browser.startup.homepage", "http://superuser.com");>>"%ffile%\prefs.js"
echo user_pref("browser.search.defaultenginename", "Google");>>"%ffile%\prefs.js"
echo user_pref("app.update.auto", false);>>"%ffile%\prefs.js"
set ffile=

cd %windir%


답변

스레드는 오래된 것이지만 어쨌든 내 솔루션을 공유하고 싶습니다. 이것이 누군가를 돕기를 바랍니다. 비슷한 문제가 있었고 Windows 스토어의 인증서를 firefox에 추가하려고했습니다. 그래서 스크립트를 만들었습니다. 어쨌든, 필요에 따라 변경할 수 있습니다. :: create cfg_file_name.cfg […]에서 행을 추가하거나 제거하고 홈페이지 시작 등에 필요한 것을 삽입하십시오 . 마지막 앞에 ^를 설정해야합니다. 그렇지 않으면 작동하지 않습니다! echo pref("browser.startup.homepage", "http://superuser.com"^);

버전 49부터는 다음과 같이 할 수 있습니다.

@echo off
setlocal enabledelayedexpansion
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: MAIN INFORMATION
:: Title: Change about:config entries in Mozilla Firefox
:: Author: I-GaLaXy-I
:: Version: 1.1
:: Last Modified: 10.01.2018
:: Last Modified by: I-GaLaXy-I
::------------------------------------------------------------------------------
:: This script will add two files, which will change about:config parameters of
:: Mozilla Firefox. You can change the name of these two files and remove or add
:: parameters according to your needs. Renaming the files could be essential, if
:: a user creates own files and you don't want to overwrite them.
::
:: If the two files already exist and the script is run, the complete content
:: of both files will be overwritten!
::
:: Note: You may have to run it with administrative privileges!
::
:: More information: https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment
:: http://kb.mozillazine.org/Locking_preferences
::------------------------------------------------------------------------------
:: Subtitle: Import CAs from Windows certificate store
:: More information: https://serverfault.com/questions/722563/how-to-make-firefox-trust-system-ca-certificates
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Set the name of the .cfg file
set cfg_file_name=add_win_certstore_cas

:: Set the name of the .js file
set js_file_name=add_win_certstore_cas

:: Registry keys to check for the installation path of Mozilla Firefox
set regkey1="HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\App Paths\firefox.exe" /v "Path"
set regkey2="HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\shell\open\command" /ve

:: Get installation path of Mozilla Firefox (if not found exit script):
reg query %regkey1%
if %errorlevel%==0 (
    :: First key found, getting path
    for /f "tokens=2* delims=    " %%a in ('reg query %regkey1%') do set path_firefox=%%b
) else (
    :: If first key not found, try another one:
    reg query %regkey2%
    if !errorlevel!==0 (
        for /f "tokens=2* delims=    " %%a in ('reg query %regkey2%') do set path_firefox=%%b
        set path_firefox=!path_firefox:\firefox.exe=!
        for /f "useback tokens=*" %%a in ('!path_firefox!') do set path_firefox=%%~a
) else (
    :: No key found, exit script
    exit
))

:: Create cfg_file_name.cfg if it doesn't exist and input the following lines.
:: Caution! If cfg_file_name.cfg already exists, all lines will be overwritten!
:: Add more lines as needed with the following syntax:
::echo pref("<name_of_config_entry>", <value>^);
(
    echo //Firefox Settings rolled out via KACE from Systec
    echo //Do not manually edit this file because it will be overwritten!
    echo //Import CAs that have been added to the Windows certificate store by an user or administrator.
    echo pref("security.enterprise_roots.enabled", true^);
) > "%path_firefox%\%cfg_file_name%.cfg"

:: Create js_file_name.js if it doesn't exist and input the following lines.
:: Caution! If js_file_name.js already exists, all lines will be overwritten!
(
    echo /* Firefox Settings rolled out via KACE from Systec
    echo Do not manually edit this file because it will be overwritten! */
    echo pref("general.config.obscure_value", 0^);
    echo pref("general.config.filename", "%cfg_file_name%.cfg"^);
) > "%path_firefox%\defaults\pref\%js_file_name%.js"

:: Files created, exit
exit


답변