Windows – Creating custom file extension with windows registry

file extensionwindowswindows-registrywindows-vista

Ok, so I have been reading and googling this for a while now and I can't understand what is going wrong. I am trying to create a .int file extension in my registry so that I can add the ShellNew key to it and thus it should allow me to do the simple right click > new > file method of file creation. So I went to HKEY_CLASSES_ROOT and I created a key called .int.
I then created a key called intfile with a default icon and set its (Default) string to "Localization File". Then in my .int key I set the (Default) intfile and created Content Type which i set to plain/text. Then I created a new key called ShellNew and in that key I set FileName to the path in WINDOWS/ShellNew where my default .int file was. However, when I right click and go to new it does not show New Localization File. Am I missing a registry entry somewhere? Any help will be greatly appreciated, I can't figure out why this isn't working as I have added ShellNew to many keys before and had it always worked flawlessly. This is my first time creating a completely new file extension but I have read other file extensions that exist and can't see why it isn't working. Ty again in advance.

Edit: Clarification of what I have set up exactly.

intfile:
     (Default) REG_SZ "Localization File"
intfile>shell>open>command:
     (Default) REG_SZ "C:\Program Files\Notepad++\notepad++.exe"
.int: 
     (Default) REG_SZ "intfile"
     ContentType REG_SZ "plain/text"
     Percieved Type REG_SZ "text"
.int>ShellNew:
     (Default) REG_SZ "null"
     FileName REG_SZ "C:\WINDOWS\ShellNew\New Int.int"

Best Answer

That's cause you didn't register your file type correctly. Well, technically, you didn't register your "application" correct.

http://msdn.microsoft.com/en-us/library/cc144148(v=vs.85).aspx#fa_register_type\

You registered .int correctly. .int says to call intfile. intfile however is where you put in the application that handles the file! So Shellex goes looking into intfile and all it finds is a string in the default field. So the operation fails.

Since you want string there, you have to supply the Shell with a default verb to execute. Under the intfile create shell\open\command. Enter the full path to your application, for example, "%ProgramFiles%\Notepad++\Notepad++.exe" "%1".

FileName is the Full path to the file you want to make a copy, so you need "%windir% and not WINDOWS.

Edit I can't believe I'm condoning this method. . .

But I don't know of any way to add this without writing a program. . .

Hacktastic

edit2:

Ok here we go.

Key .int has Default(SZ) = intfile and Context Type(SZ) = plain.text. Under Key .int, you'll have subkey Shellnew. The default should be empty. Make a new empty string (Reg_SZ) and for the value put in the filename: `C:\windows\ShellNew\NewLocalization File'.

Under intfile make the default New Localization File.

Note the lack of double quotes. Now intfile needs the following subkeys: shell, make it's Default = open. Next, make subkey open under shell.

Now make subkey command under open.

Put the full path of the program under the string with quotes. ie "c:\Program Files (x86)\Notepad++\notepad++.exe" "%1". Note there are double quotes.

Edit:3

So it looks like the OP ran into an unknown issue and solved it this way.

Hrm ok figured it out! You were right mostly, and I was right a little. The problem was I had opened the file once and set the default program to notepad++ in the pop up dialogue. This created a key called int_auto_file. I went through the registry, very time consuming, and deleted all references to the .int extension. After that I rebuilt them and now it works perfectly.

Related Question