# TeXworks won't open *.cls extensions

I've always used MikTeX as the main LaTeX base to compile/write my `*.tex/*.sty/*.cls` files, so I downloaded the specific version 2.9.4521-x64 on my first computer (running Windows 7 Professional); and then the file extensions mentioned above were correctly recognized by the OS, as it can be seen inside a generic folder:

There is a difference regarding the file type (`tipo=type`) `LaTeX Class` and `LaTeX Style` that recognizes automatically the derived extensions; and so on my first machine I've had no problems at all.

The problem rised when bought a new computer, same OS, and installed the same version of MikTeX; then when I looked back on the same folder the file extension for class was no more recognized correctly by Windows:

Here the file type that describes a class file is recognized as `CLS file`, and not `LaTeX Class`, because I had to manually connect the program that will be able to read the extension, as it can be seen by the different icon appeared in the aforementioned image.

I know it may seem as a not-so-dramatic issue, but I don't know what is causing it, and since there is an image proof surely something must have happened.

EDIT: As karlkoeller suggested, removing the current TeXworks version from the MikTeX distribution and installing a brand new one generates this output:

So it looks like I'm back on where I started.

-
Note that it is TeXworks that is responsible of these changes, not MiKTeX itself. – karlkoeller Oct 11 '13 at 20:32
@karlkoeller That is quite problematic, because I couldn't find any documentation that tells exactly how to separate TeXworks from the MikTeX distribution. If I could obtain this info, I'll surely uninstall and replace it with the 0.45 version. – Andrea L. Oct 11 '13 at 20:35
In "MiKTeX Package Manager" remove "miktex-texworks-bin-2.9". This should eliminate TeXworks from MiKTeX installation. – karlkoeller Oct 11 '13 at 20:38
@karlkoeller I tried, but the result wasn't too satisfying... (see edit.) – Andrea L. Oct 11 '13 at 20:47
@karlkoeller Maybe inside the `texworks-config` will be something useful to do. Otherwise, apart from installing antother IDE, what are my possibilities? – Andrea L. Oct 11 '13 at 21:08

This is what you can do.

I'm assuming that you've installed MiKTeX 64-bit and your installation directory is `C:\Program Files\MiKTeX 2.9`.

Before proceeding, be sure that the file `miktex-texworks.exe` exists in the folder `C:\Program Files\MiKTeX 2.9\miktex\bin\x64`.

Create a file `additions.reg` with the following contents (adjust it with the right directories if the above assumptions are not right):

``````Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.bib]
@="MiKTeX.bib.2.9"

[HKEY_CLASSES_ROOT\.cls]
@="MiKTeX.cls.2.9"

[HKEY_CLASSES_ROOT\.dtx]
@="MiKTeX.dtx.2.9"

[HKEY_CLASSES_ROOT\.ltx]
@="MiKTeX.ltx.2.9"

[HKEY_CLASSES_ROOT\.sty]
@="MiKTeX.sty.2.9"

[HKEY_CLASSES_ROOT\.tex]
@="MiKTeX.tex.2.9"

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9]
@="BibTeX Database"

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9]
@="LaTeX Class"

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9]
@="LaTeX Macros"

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9]
@="LaTeX Document"

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9]
@="LaTeX Style"

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9]
@="TeX Document"

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""
``````

At this point, the only thing you have to do is to double-click this file so to add this information into the Windows registry. If you are not able to see the icons, restart Windows.

-
One more thing. After double-clicking on `additions.reg`, what should I do with the file afterwards? Do I have to delete it or keep it? (by induction I'd say the first but I'm not sure). – Andrea L. Oct 12 '13 at 8:58
After the info has been incorporated in the Windows registry you can delete it. – karlkoeller Oct 12 '13 at 9:02
After doing everything the OS continues to recognize only `CLS file`, I'm starting to think that on its own has decided to get on my nerves now... – Andrea L. Oct 12 '13 at 9:09
Do you have admin rights? – karlkoeller Oct 12 '13 at 9:09
At a first glance I'd say yes but I'm 99.99% sure. Is there a way to confirm this (I know it may be not related to TeX, but it'd help me to understand better)? – Andrea L. Oct 12 '13 at 9:11