Creating custom file extension with windows registry

6,105

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.

Share:
6,105

Related videos on Youtube

Barrett
Author by

Barrett

Updated on September 18, 2022

Comments

  • Barrett
    Barrett over 1 year

    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"
    
  • surfasb
    surfasb almost 13 years
    You can use Reg_SZ. You'll need to just put it in quotes. Just like I typed it.
  • surfasb
    surfasb almost 13 years
    Humm, you are right. You can't change that to an expandable string type. Gotta hack it and put it in as a string.
  • surfasb
    surfasb almost 13 years
    So you get nothing in your menu?
  • Barrett
    Barrett almost 13 years
    Yeah, I can't see the New Localization File option in my menu. I am not sure if I am just missing something simple.
  • surfasb
    surfasb almost 13 years
    I'll edit my answer to make it more clear.
  • Barrett
    Barrett almost 13 years
    I edited the question to show exactly what I have entered into the Registry as well.
  • Barrett
    Barrett almost 13 years
    I can't edit my last comment... anyway. The reason I think this is that in Explorer windows it is calling .int files under the type column INT File, so I am not sure why it is doing that, I can't find that string anywhere in the registry
  • surfasb
    surfasb almost 13 years
    I'm pretty sure it is not. It would be calliing INT if .ini default program handler was was INT. Since you specify intfile for the Default, it would not do that. . .
  • Barrett
    Barrett almost 13 years
    For some reason under Type in explorer though it is given the name INT File, even though I have specified that it should be called a Localization File in my intfile key.
  • surfasb
    surfasb almost 13 years
    I'll just highlight the problem you ran into for future readers.
  • Barrett
    Barrett almost 13 years
    Awesome that should take care of most issues.