Jump to content

Reg file for setting the default browser to firefox 1.5


Recommended Posts


You can already do it simply by running firefox with the ' -setDefaultBrowser' switch.

Starting from v 1.6 (still beta), you will be able to do it unattended: the ' -silent' switch of firefox will work again, so something like the line below will do the trick the right way:

"%ProgramFiles%\Mozilla Firefox\firefox.exe" -silent -setDefaultBrowser

You'll have to have a valid profile already defined or add the ' -CreateProfile default' switch, tho. Otherwise, you'll be asked to import IE settings.

Link to comment
Share on other sites

There are actually a number of flaws in the reg file posted!

  • 1. You may invoke the file accidentally even though you haven't got Firefox installed. Doing so will change many registry keys for no reason, and require a roll back or manual edit to fix.
    2. PROGRA~1\\MOZILL~1 could be machine specific depending upon your current directory contents. You could have for instance PROGRA~1\\MOZILL~1 for Mozilla Thunderbird. If Firefox is installed and in the default location, then that is unlikely, but still remains a possibility. This of course also highlights the possibility that Firefox may not be installed under 'Program Files' never mind with a folder named 'Mozilla Firefox'
    3. The data values for HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Desktop may be completely different. The existing data from your current keys are backed up to those keys and are therefore machine specific. You have assumed that the .htm and .html keys had not previously been registered to as another filetype. The StartMenuInternet key may have also been assigned to an application other than Internet Explorer.

Taking all these things into account, the registry file would probably be better suited to new unattended builds and or users who always accept the defaults.

If you wanted something a little more universal, (for win2k with resource kit and above), try the attached outrageous specimen, it is untested.

setfirefoxdefault.cmd

Link to comment
Share on other sites

Taking all these things into account, the registry file would probably be better suited to new unattended builds and or users who always accept the defaults.
And for the life of me I cannot understand why anyone would do it otherwise, anal retentive?, think they doin something thats different is best? Because that is so easy it ain't funny, put the stuff where it belongs and anything in the future knows what to do. What part of this do I not understand?

I've been doing it the same way from 1.x, yes default Install with a twist

Translated

REG ADD %KEY%\1001 /VE /D "Firefox 1.5 beta 1" /f

REG ADD %KEY%\1001 /V 101 /D "CMD /C Start /Wait D:\APPS\Mozilla.Firefox_1.xx\Firefox_autoit.exe" /f

REG ADD %KEY%\1001 /V 102 /D "CMD /C Start /Wait SLEEP.EXE 3" /f

REG ADD %KEY%\1001 /V 103 /D "CMD /C RD \"%USERPROFILE%\Application Data\Mozilla\" /S /Q"" /f

REG ADD %KEY%\1001 /V 104 /D "CMD /C Start /Wait SLEEP.EXE 5" /f

REG ADD %KEY%\1001 /V 105 /D "cmd /c XCOPY \"D:\APPS\Mozilla.Firefox_1.xx\Mozilla\" \"%USERPROFILE%\Application Data\Mozilla\" /I /E /H /Y" /f

REG ADD %KEY%\1001 /V 106 /D "cmd /c XCOPY \"D:\APPS\Mozilla.Firefox_1.xx\plugins\" \"%ProgramFiles%\Mozilla Firefox\plugins\" /I /E /H /Y" /f

REG ADD %KEY%\1001 /V 107 /D "cmd /c XCOPY \"D:\APPS\Mozilla.Firefox_1.xx\searchplugins\" \"%ProgramFiles%\Mozilla Firefox\searchplugins\" /I /E /H /Y" /f

REG ADD %KEY%\1001 /V 108 /D "CMD /C Start /Wait D:\APPS\Mozilla.Firefox_1.xx\install_flash_player.exe /S" /f

REG ADD %KEY%\1001 /V 109 /D "CMD /C DEL \"%USERPROFILE%\Application Data\Microsoft\Internet Explorer\Quick Launch\Mozilla Firefox.lnk\"" /f

REG ADD %KEY%\1001 /V 110 /D "CMD /C DEL \"%ALLUSERSPROFILE%\Application Data\Microsoft\Internet Explorer\Quick Launch\Mozilla Firefox.lnk\"" /f

REG ADD %KEY%\1001 /V 111 /D "REGEDIT /S D:\APPS\Mozilla.Firefox_1.xx\setfirefoxdefault.reg" /f

Well I'll be danged, complete with everything saved from a previous Install, everything, all my settings, bookmarks, plugins, passwords. I just click a checkbox and all thats done for me but you can see what needs done and modify to your Install

and thanks again NuVanDibe for the reg, works for us defaulters

Edit: The point of this being do things in the correct order.

I'm sure when I decide to get 1.6 I'll use the -setDefaultBrowser

Edited by maxXPsoft
Link to comment
Share on other sites

@maxXPsoft, I'm sure you can wait until 1.6, but just in case you can't wait anymore (this can happen to you if you don't suffer from anal retention ;)), here is a little suppository of mine that will patch your firefox (if needed) to add the necessary ' -silent' switch (according to Bugzilla) and then apply the ' -setDefaultBrowser'.

FirefoxSetDefaultBrowser.cmd

@ECHO OFF &SETLOCAL ENABLEEXTENSIONS

::javascript file to patch
SET "JSTOPATCH=components\nsBrowserContentHandler.js"
::javascript line in the file: line to search for deciding to patch or not
SET "ESCSEARCH= if (cmdLine.handleFlag(\"silent\", false))"
::javascript lines in the file: marker lines to insert the patch after
SET "MARKER1= if (cmdLine.handleFlag("preferences", false)) {"
SET "MARKER2= }"
::javascript lines in the file: actual patch lines to insert
SET "PATCHLINE1= if (cmdLine.handleFlag("silent", false))"
SET "PATCHLINE2= cmdLine.preventDefault = true;"

::Find Firefox install directory. ©Yzöwl
FOR /F "TOKENS=3 DELIMS= " %%? IN (
'REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<Install Directory\>" 2^>NUL'
) DO (IF ERRORLEVEL 0 (SET JSCRIPT=%%~s?%JSTOPATCH%))
IF NOT EXIST %JSCRIPT% (ENDLOCAL &GOTO :EOF)

::check if the -silent option already exists, if yes, no need to patch
FINDSTR /B /C:"%ESCSEARCH%" %JSCRIPT% >nul
IF NOT ERRORLEVEL 1 GOTO SETDEFAULT

:patch : add the -silent command line option on versions <1.6
::according to Bugzilla: [url="https://bugzilla.mozilla.org/show_bug.cgi?id=324023"]https://bugzilla.mozilla.org/show_bug.cgi?id=324023[/url]
echo Patching Firefox: re-add the -silent command line option...

SET INSERTHERE=NOWAITNOTHERE
IF EXIST %JSCRIPT%.patch DEL %JSCRIPT%.patch
FOR /F "TOKENS=* DELIMS=" %%? IN (%JSCRIPT%) DO (
>>%JSCRIPT%.patch ECHO\%%?
IF "%%?"=="%MARKER1%" SET INSERTHERE=YESHERE
IF "%%?"=="%MARKER2%" CALL :SUB_INSERT "%%?"
)
IF EXIST %JSCRIPT%.patch MOVE /Y %JSCRIPT%.patch %JSCRIPT%

:SETDEFAULT
echo Set Firefox as the default browser...

::Find Firefox exe path. ©Yzöwl
FOR /F "TOKENS=3 DELIMS= " %%? IN (
'REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<PathToExe\>" 2^>NUL'
) DO (IF ERRORLEVEL 0 (SET SPF=%%~s?))
IF NOT DEFINED SPF (ENDLOCAL &GOTO :EOF)

::Backup the actual profile folder and create a dummy one (needed by firefox)
IF EXIST "%APPDATA%\Mozilla\Firefox" RENAME "%APPDATA%\Mozilla\Firefox" FirefoxTempFolderSetDefault
START /WAIT %SPF% -CreateProfile default

START /WAIT %SPF% -silent -setDefaultBrowser
PING -n 2 LOCALHOST>nul

::Remove the dummy profile and set back the existing one if any
RD /S /Q "%APPDATA%\Mozilla\Firefox" >nul
IF EXIST "%APPDATA%\Mozilla\FirefoxTempFolderSetDefault" (
RENAME "%APPDATA%\Mozilla\FirefoxTempFolderSetDefault" Firefox >nul
)

echo ...Done!
pause
ENDLOCAL &GOTO :EOF


:SUB_INSERT
::Patching function
IF NOT "%INSERTHERE%"=="YESHERE" EXIT/B
>>%JSCRIPT%.patch ECHO\%PATCHLINE1%
>>%JSCRIPT%.patch ECHO\%PATCHLINE2%
echo\************ PATCHED ****************
SET INSERTHERE=ALREADYDONE
EXIT/B

For unattended use, remove the 'pause' after 'echo ...Done!'. All 'echo' lines (with 'echo' in small letters) can also be removed safely.

Don't Panic, it's mostly harmless (only known side effects are the disapearing of all the dolphins blank lines and the replacement of the LF endings by CRLF ones inside the patched javascript file. but hey, you don't plan to read it anyway, do you?).

Edited by Djé
Link to comment
Share on other sites

thanks Djé

But I can wait on the 1.6, prob not that far off.

I just hate adding scripts cause sooner or later i'm script(full) or delightfull or one of those full's. Point being when you add so many you kinda loose track of where you goin and where you been and bing bada boom they done updated so back to modify what worked in the first place.

Its the difference between a script which may crash somewhere down the line and -setDefaultBrowser, easy choice for me

The reg works fine here

Edited by maxXPsoft
Link to comment
Share on other sites

Yes, it's coming closer: version 1.5.0.2 has been released :) without the bug fix for -silent yet :(

But with a possibility to bypass the import IE setting wizard. I'll investigate.

Hopefully, it should be in the next version (file version:1.8.0.3 while actual is 1.8.0.2).

Anyway, you're true about those scripts files everywhere. But then, reg files are the same. So one or another, as long as it works...

cheers

Edited by Djé
Link to comment
Share on other sites

  • 2 weeks later...
FirefoxSetDefaultBrowser.cmd

@ECHO OFF &SETLOCAL ENABLEEXTENSIONS

::javascript file to patch
SET "JSTOPATCH=components\nsBrowserContentHandler.js"
::javascript line in the file: line to search for deciding to patch or not
SET "ESCSEARCH= if (cmdLine.handleFlag(\"silent\", false))"
::javascript lines in the file: marker lines to insert the patch after
SET "MARKER1= if (cmdLine.handleFlag("preferences", false)) {"
SET "MARKER2= }"
::javascript lines in the file: actual patch lines to insert
SET "PATCHLINE1= if (cmdLine.handleFlag("silent", false))"
SET "PATCHLINE2= cmdLine.preventDefault = true;"

::Find Firefox install directory. ©Yzöwl
FOR /F "TOKENS=3 DELIMS= " %%? IN (
'REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<Install Directory\>" 2^>NUL'
) DO (IF ERRORLEVEL 0 (SET JSCRIPT=%%~s?%JSTOPATCH%))
IF NOT EXIST %JSCRIPT% (ENDLOCAL &GOTO :EOF)

::check if the -silent option already exists, if yes, no need to patch
FINDSTR /B /C:"%ESCSEARCH%" %JSCRIPT% >nul
IF NOT ERRORLEVEL 1 GOTO SETDEFAULT

:patch : add the -silent command line option on versions <1.6
::according to Bugzilla: [url="https://bugzilla.mozilla.org/show_bug.cgi?id=324023"]https://bugzilla.mozilla.org/show_bug.cgi?id=324023[/url]
echo Patching Firefox: re-add the -silent command line option...

SET INSERTHERE=NOWAITNOTHERE
IF EXIST %JSCRIPT%.patch DEL %JSCRIPT%.patch
FOR /F "TOKENS=* DELIMS=" %%? IN (%JSCRIPT%) DO (
>>%JSCRIPT%.patch ECHO\%%?
IF "%%?"=="%MARKER1%" SET INSERTHERE=YESHERE
IF "%%?"=="%MARKER2%" CALL :SUB_INSERT "%%?"
)
IF EXIST %JSCRIPT%.patch MOVE /Y %JSCRIPT%.patch %JSCRIPT%

:SETDEFAULT
echo Set Firefox as the default browser...

::Find Firefox exe path. ©Yzöwl
FOR /F "TOKENS=3 DELIMS= " %%? IN (
'REG QUERY "HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /S ^|FINDSTR "\<PathToExe\>" 2^>NUL'
) DO (IF ERRORLEVEL 0 (SET SPF=%%~s?))
IF NOT DEFINED SPF (ENDLOCAL &GOTO :EOF)

::Backup the actual profile folder and create a dummy one (needed by firefox)
IF EXIST "%APPDATA%\Mozilla\Firefox" RENAME "%APPDATA%\Mozilla\Firefox" FirefoxTempFolderSetDefault
START /WAIT %SPF% -CreateProfile default

START /WAIT %SPF% -silent -setDefaultBrowser
PING -n 2 LOCALHOST>nul

::Remove the dummy profile and set back the existing one if any
RD /S /Q "%APPDATA%\Mozilla\Firefox" >nul
IF EXIST "%APPDATA%\Mozilla\FirefoxTempFolderSetDefault" (
RENAME "%APPDATA%\Mozilla\FirefoxTempFolderSetDefault" Firefox >nul
)

echo ...Done!
pause
ENDLOCAL &GOTO :EOF


:SUB_INSERT
::Patching function
IF NOT "%INSERTHERE%"=="YESHERE" EXIT/B
>>%JSCRIPT%.patch ECHO\%PATCHLINE1%
>>%JSCRIPT%.patch ECHO\%PATCHLINE2%
echo\************ PATCHED ****************
SET INSERTHERE=ALREADYDONE
EXIT/B

For unattended use, remove the 'pause' after 'echo ...Done!'. All 'echo' lines (with 'echo' in small letters) can also be removed safely.

Could you write one for thunderbird?

Link to comment
Share on other sites

Well i used setfirefoxdefault.reg file posted and spent a day trying to get .htm and .html files sorted they had no icons luckily i found this vbs script on the net

'--------------------------------------------------------------
'Applies To : Microsoft Windows XP
'Author : Ramesh Srinivasan - Microsoft MVP [Windows XP]
'Created on : January 17, 2006
'Description : Fixes the icons for HTM/HTML/MHT/MHTML files
'Homepage : http://windowsxp.mvps.org
'More Info : http://windowsxp.mvps.org/htmicon.htm
'Prerequisite : Windows XP systems / Administrative privileges
'--------------------------------------------------------------

Set WshShell = CreateObject("WScript.Shell")
On Error resume Next
WshShell.RegWrite "HKCR\.htm\", "htmlfile", "REG_SZ"
WshShell.RegWrite "HKCR\.html\", "htmlfile", "REG_SZ"
WshShell.RegWrite "HKCR\.mht\", "mhtmlfile", "REG_SZ"
WshShell.RegWrite "HKCR\.mhtml\", "mhtmlfile", "REG_SZ"
WshShell.RegWrite "HKCR\htmlfile\DefaultIcon\", "%Programfiles%\Internet Explorer\IEXPLORE.EXE,1", "REG_EXPAND_SZ"
WshShell.RegWrite "HKCR\mhtmlfile\DefaultIcon\", "%Programfiles%\Internet Explorer\IEXPLORE.EXE,22", "REG_EXPAND_SZ"
WshShell.Regdelete "HKCR\htmlfile\ShellEx\IconHandler\"
WshShell.Regdelete "HKCR\mhtmlfile\ShellEx\IconHandler\"
WshShell.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.HTM\Application"
WshShell.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.HTM\ProgID"
WshShell.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.HTML\Application"
WshShell.Regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.HTML\ProgID"
WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE\", "%Programfiles%\Internet Explorer\IEXPLORE.EXE", "REG_EXPAND_SZ"
Wshshell.RUN ("regsvr32.exe mshtml.dll -i -s")
Wshshell.RUN ("regsvr32.exe shdocvw.dll -i -s")
MsgUser = Msgbox ("Fixed the registry settings. Restart Windows for the changes to take effect", 4160, "HTML icon fix for Windows XP")
Set WshShell = Nothing

Edited by urie
Link to comment
Share on other sites

urie, who have you quoted? no-one in this thread appears to have said that!

Also why would a script which associates filetypes etc. with IE be of any use to Firefox users.

Link to comment
Share on other sites

Yzöwl i used the reg file posted here

http://www.msfn.org/board/index.php?s=&showtopic=71739&view=findpost&p=490133

Also why would a script which associates filetypes etc. with IE be of any use to Firefox users.

i had to use the vbs script i posted to get registry setting back to default as i said there were no icons on html or htm files not even when firefox was set to default browser.

Link to comment
Share on other sites

  • 1 month later...

Well No need to wait for 1.6.

firefox 1.5.0.4 is out and implements the -silent switch.

So attached should be the definitive -setDefaultBrowser.cmd

It is designed to work in a very broad variety of situations.

If you find it non working in yours, I'd be curious to know about...

Firefox_setDefaultBrowser.cmd

Edited by Djé
Link to comment
Share on other sites

  • 1 month later...

Here we go!

This is the one for Thunderbird.

Although Tb has a 'setDefaultMail' switch, it doesn't look like it's working.

So this script is doing it the historic way: DIY reg entries.

It uses the REG command, so it's not suitable for vanilla win2K.

Use it with the -h or /help switch to display the help message which will give you the different options.

setDefaultMail.cmd

Edited by Djé
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...