Search code examples
windowsregistrynsisfile-association

Windows File Association using NSIS Script


I am using NSIS to create installer for my application. I want to provide the feature in which user can double click and open a file of a particular file extension in my application. I have followed instructions provided in this link: http://gergo.erdi.hu/blog/2006-10-08-registering_windows_file_types_with_nsis/.

But it doesn't create registry key for me. My guess is that probably the installer has to be run as an administrator. But I don't unnecessarily want to prompt the user for administrative privilege.

How can I then associate my custom file type and icon with my application?

PS: I am using Windows 7 64 bit.


Solution

  • Try to write the keys into HKEY_CURRENT_USER\Software\Classes instead of HKEY_CLASSES_ROOT. This should work without administrator privileges under Vista and later.