How to set file associations and explorer options in one go?

2

This has been itching me for quite a long time. When I come on a new computer with any version of Windows, I need to:

  • un-hide file extensions
  • set explorer default view to list instead of icons
  • set the file extensions like h c cpp so they don't open Visual C++ (which can take up to 20 seconds!) each time I double click on them, opening them with something like Notepad++ instead.

Isn't there some program to quickly set thoses options to something I want, like some standalone exe, or some generic registry file I can execute when I come on a new machine?

I'm a developer and I can't believe I'm wasting so much time on those &*$%@# things.

jokoon

Posted 2010-12-22T12:19:43.820

Reputation: 375

Answers

1

You can do this all through the registry:

Unhide file extensions for known filetypes

You can use the following DWORD to make the file extensions visible:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"HideFileExt"=dword:00000000

Setting the default Explorer view to 'List'

Setting default explorer view is somewhat more difficult, I always have it in my options when nLiting (you might want to look into nLite, it can automate a lot of stuff during installation and set system settings like the ones you describe).

I assume this key will work (taken straight from my registry), but assuming it doesn't make sure to back up your existing value for Settings first.

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams]
"Settings"=hex:08,00,00,00,04,00,00,00,01,00,00,00,00,77,7e,13,73,35,cf,11,ae,\
69,08,00,2b,2e,12,62,04,00,00,00,01,00,00,00,43,00,00,00

Automatically opening certain filetypes in Notepad++

Now, for the automatic opening in Notepad++ go to these keys (or create them):

[HKEY_LOCAL_MACHINE\Software\Classes\.h]
[HKEY_LOCAL_MACHINE\Software\Classes\.c]
[HKEY_LOCAL_MACHINE\Software\Classes\.cpp]

And then create/modify the default string (look at the other keys in Classes to see the way it is done).

This registry file should handle your specific needs:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"HideFileExt"=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams]
"Settings"=hex:08,00,00,00,04,00,00,00,01,00,00,00,00,77,7e,13,73,35,cf,11,ae,\
69,08,00,2b,2e,12,62,04,00,00,00,01,00,00,00,43,00,00,00

[HKEY_LOCAL_MACHINE\Software\Classes\.h]
@="nppfile"

[HKEY_LOCAL_MACHINE\Software\Classes\.c]
@="nppfile"

[HKEY_LOCAL_MACHINE\Software\Classes\.cpp]
@="nppfile"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\nppfile\DefaultIcon]
@=hex(2):25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,\
  00,73,00,25,00,5c,00,4e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,\
  5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,2e,00,65,00,78,\
  00,65,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\nppfile\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00

Matthieu Cartier

Posted 2010-12-22T12:19:43.820

Reputation: 3 422

Yes I know nLite, it's a great tool, but that won't help if I'm working on a machine where it's already installed. Anyway thanks for the help it's greatly appreciated. So normally I just paste all this into a text file rename it to .reg and it shall work ? – jokoon – 2010-12-22T12:43:43.470

I could make you a reg if you give me the location that Notepad++ will be installed in :) – Matthieu Cartier – 2010-12-22T12:45:39.443

by default, "C:\Program Files\Notepad++" – jokoon – 2010-12-22T17:20:20.063

another problem, when I associate file with notepad++, I can't change one icon without changing all other filetypes that have been associated with notepad++. How do you set extensions icons in the registry ? – jokoon – 2010-12-22T17:21:40.577

1Added the reg for you. – Matthieu Cartier – 2010-12-22T17:25:51.307

To do that you set DefaultIcon, you can see how I've done it in the reg, it's very easy to manipulate :) If you just want to change the icon for another type, duplicate the key (like nppfile) and then change the value for DefaultIcon to what you're wanting. – Matthieu Cartier – 2010-12-22T17:30:43.240