8
$\begingroup$

Is there a way to set the default Mathematica version? I would like to run both versions 7 and 8 (on a Win7 PC), but when version 8 is installed it takes priority. Clicking on a notebook automatically opens in version 8. What can I set to make version 7 the default?

$\endgroup$
3
  • $\begingroup$ Something like ControlPanel -> Programs -> Default Programs -> Associate a file type ... ? $\endgroup$ Commented Nov 21, 2012 at 15:34
  • $\begingroup$ You can also right click on a .nb file and choose Open With -> Choose default program. $\endgroup$ Commented Nov 21, 2012 at 15:36
  • $\begingroup$ @ b.gatessucks - choose default program is completely ignored, as is associate file type, as I recall. I have heard it can be done with a registry hack. That wouldn't be my preferred solution, but does anyone know it, or an alternative? $\endgroup$ Commented Nov 21, 2012 at 16:26

1 Answer 1

7
$\begingroup$

Yes, you can. There is undocumented FE command-line option -directLaunch which switches off the mechanism which always launches the most recent FE version installed. Under Windows you can use a .reg-file for switching .nb-associations between different MMa versions installed.

Before proceeding, I should point out that modifyng the system registry is potentially dangerous operation and doing it in a wrong way may cause damage of your system.

I do not have MMa 7 installed but the following is the contents of a .reg file which associates MMa files with Mathematica 5.2 installed in the default location (I used it and it works perfect):

REGEDIT4

[HKEY_CLASSES_ROOT\.ma]
@="MathematicaMA"

[HKEY_CLASSES_ROOT\.nb]
@="MathematicaNB"

[HKEY_CLASSES_ROOT\MathematicaNB]
@="Mathematica 5.2 for Students Notebook"
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000008

[HKEY_CLASSES_ROOT\MathematicaNB\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\5.2\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\MathematicaNB\shell]
@="open"

[HKEY_CLASSES_ROOT\MathematicaNB\shell\open]
@="Open with Mathematica 5.2"

[HKEY_CLASSES_ROOT\MathematicaNB\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\5.2\\Mathematica.exe\" -directlaunch \"%1\""

Copy the cited text, paste it into Notepad and save with "reg" extension, then run it. Choose "Yes" to apply changes when the dialog window appear.

For switching backward to MMa 8.0.4 you can use the following .reg-file:

REGEDIT4

[HKEY_CLASSES_ROOT\.m]
@="Mathematica.M.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.ma]
@="Mathematica.MA.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.nb]
@="Mathematica.NB.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.nbp]
@="Mathematica.NBP.8.0.4.2615665"

As for changing .nb-files association to Mathematica 7.0.0 (note that for version 7.0.1 it should be changed accordingly), the following .reg-file should work (but I cannot check it because have no version 7 installed):

REGEDIT4

[HKEY_CLASSES_ROOT\.nb]
@="Mathematica.NB.7.0.0.1148351"

[HKEY_CLASSES_ROOT\Mathematica.NB.7.0.0.1148351\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\7.0\\Mathematica.exe\" -directlaunch \"%1\""

Note also that it is recommended to set the global FE option "VersionedPreferences" to True to avoid conflicts between different MMa versions installed.

UPDATE

For anyone who wish to switch Mathematica's files associations between installed versions 8.0.4 (8.0.4.2615665) and 9.0.0 (9.0.0.3868239) here are two ready-to-use Windows .reg-files. (They also disable the splash screen and make launching of Mathematica faster.)

For switching to the version 8.0.4.2615665:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.nb]
@="Mathematica.NB.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.nbp]
@="Mathematica.NBP.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.cdf]
@="Mathematica.CDF.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.m]
@="Mathematica.M.8.0.4.2615665"

[HKEY_CLASSES_ROOT\.ma]
@="Mathematica.MA.8.0.4.2615665"

[HKEY_CLASSES_ROOT\Mathematica.NB.8.0.4.2615665]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.NB.8.0.4.2615665\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\Mathematica.NB.8.0.4.2615665\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.NB.8.0.4.2615665\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.NB.8.0.4.2615665\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.M.8.0.4.2615665]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.M.8.0.4.2615665\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\Mathematica.M.8.0.4.2615665\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.M.8.0.4.2615665\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.M.8.0.4.2615665\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.CDF.8.0.4.2615665]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.CDF.8.0.4.2615665\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-103"

[HKEY_CLASSES_ROOT\Mathematica.CDF.8.0.4.2615665\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.CDF.8.0.4.2615665\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.CDF.8.0.4.2615665\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.NBP.8.0.4.2615665]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.NBP.8.0.4.2615665\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-103"

[HKEY_CLASSES_ROOT\Mathematica.NBP.8.0.4.2615665\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.NBP.8.0.4.2615665\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.NBP.8.0.4.2615665\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.MA.8.0.4.2615665]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.MA.8.0.4.2615665\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\Mathematica.MA.8.0.4.2615665\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.MA.8.0.4.2615665\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.MA.8.0.4.2615665\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

For switching to the version 9.0.0.3868239:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.nb]
@="Mathematica.NB.9.0.0.3868239"

[HKEY_CLASSES_ROOT\.nbp]
@="Mathematica.NBP.9.0.0.3868239"

[HKEY_CLASSES_ROOT\.cdf]
@="Mathematica.CDF.9.0.0.3868239"

[HKEY_CLASSES_ROOT\.m]
@="Mathematica.M.9.0.0.3868239"

[HKEY_CLASSES_ROOT\.ma]
@="Mathematica.MA.9.0.0.3868239"

[HKEY_CLASSES_ROOT\Mathematica.NB.9.0.0.3868239]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.NB.9.0.0.3868239\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\Mathematica.NB.9.0.0.3868239\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.NB.9.0.0.3868239\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.NB.9.0.0.3868239\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.M.9.0.0.3868239]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.M.9.0.0.3868239\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\Mathematica.M.9.0.0.3868239\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.M.9.0.0.3868239\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.M.9.0.0.3868239\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.CDF.9.0.0.3868239]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.CDF.9.0.0.3868239\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-103"

[HKEY_CLASSES_ROOT\Mathematica.CDF.9.0.0.3868239\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.CDF.9.0.0.3868239\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.CDF.9.0.0.3868239\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.NBP.9.0.0.3868239]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.NBP.9.0.0.3868239\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-103"

[HKEY_CLASSES_ROOT\Mathematica.NBP.9.0.0.3868239\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.NBP.9.0.0.3868239\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.NBP.9.0.0.3868239\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

[HKEY_CLASSES_ROOT\Mathematica.MA.9.0.0.3868239]
@="Mathematica Package"

[HKEY_CLASSES_ROOT\Mathematica.MA.9.0.0.3868239\DefaultIcon]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\",-102"

[HKEY_CLASSES_ROOT\Mathematica.MA.9.0.0.3868239\shell]
@="open"

[HKEY_CLASSES_ROOT\Mathematica.MA.9.0.0.3868239\shell\open]
@="&Open"

[HKEY_CLASSES_ROOT\Mathematica.MA.9.0.0.3868239\shell\open\command]
@="\"C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\Mathematica.exe\"  -directLaunch -b  \"%1\""

The only difference between the above two files is replacement "8.0.4.2615665" with "9.0.0.3868239". Checked under Windows XP SP3.

$\endgroup$
3
  • 1
    $\begingroup$ Hi Alexey, I just found your ealier post on this topic. stackoverflow.com/q/6382762/879601 - It looks interesting, but I haven't got around to altering my registry yet. $\endgroup$ Commented Nov 29, 2012 at 13:26
  • $\begingroup$ @ Alexey - I only needed to do the last bit, then Mathematica respected the version selected in Win7 "Choose default program". Great!! So, to recap: I ran SetOptions[$FrontEnd, "VersionedPreferences" -> True], then found the M7 version: Select[Developer`EnumerateRegistrySubkeys["HKEY_CLASSES_ROOT"], StringMatchQ[#, "Mathematica.NB." ~~ ___] || # === "MathematicaNB" &] and then ran this registry edit: REGEDIT4 [HKEY_CLASSES_ROOT\Mathematica.NB.7.0.1.1213966\shell\open\command] @="\"C:\\Program Files\\Wolfram Research\\Mathematica\\7.0\\Mathematica.exe\" -directlaunch \"%1\"" $\endgroup$ Commented Nov 29, 2012 at 17:17
  • 1
    $\begingroup$ @Chris Thanks, I had completely forgotten that work: I used these things very rarely. $\endgroup$ Commented Nov 29, 2012 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.