# Make Emacs the default program for text files on Windows

To make Emacs the default editor for text files on Windows, save this as `emacsdefault.reg` and then run it with the registry editor:
```Windows Registry Editor Version 5.00
;
;  Anything defined as a "txtfile" is opened with Emacs.
;
[HKEY_CLASSES_ROOT\txtfile\shell]
[HKEY_CLASSES_ROOT\txtfile\shell\open]
[HKEY_CLASSES_ROOT\txtfile\shell\open\command]
@="\"C:\\Program Files\\emacs-23.1\\bin\\emacsclientw.exe\" -n -a \"C:\\Program Files\\emacs-23.1\\bin\\emacs.exe\" \"%1\""
```
This works with Windows XP and Windows Vista. See Add Emacs to the Windows file menu for explanations of the commands on the final line (they are identical).