Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wanted to create my own file extension and set two actions possible to do with the file.

Here is .reg file I created:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.dls\]
@="DLSource"

[HKEY_CLASSES_ROOT\.dls\ShellNew]
"FileName"="source.dls"
"NullFile"="source.dls"

[HKEY_LOCAL_MACHINE\Software\Classes\DLSource\shell\]


[HKEY_LOCAL_MACHINE\Software\Classes\DLSource\shell\Open in DLI\command]
@="C:\\dl\\DLI.exe \"%1\""

[HKEY_LOCAL_MACHINE\Software\Classes\DLSource\DefaultIcon]
@="c:\\dl\\fav.ico"

[HKEY_LOCAL_MACHINE\Software\Classes\DLSource\shell\Compile with DLC\command]
@="C:\\dl\\DLC.exe \"%1\""

It works correctly, but Compile with DLC is default and is higher in context menu than Open in DLI. I want to set it oppositely, I suppose that now it's sorted alphabetical. Here is pic how it is now: Now

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.dls]
@="DLSource"

[HKEY_CLASSES_ROOT\.dls\ShellNew]
"FileName"="source.dls"
"NullFile"="source.dls"

[HKEY_CLASSES_ROOT\DLSource\DefaultIcon]
@="c:\\dl\\fav.ico"

[HKEY_CLASSES_ROOT\DLSource\shell]
@="OpeninDLI"

[HKEY_CLASSES_ROOT\DLSource\shell\CompilewithDLC]
@="Compile with DLC"

[HKEY_CLASSES_ROOT\DLSource\shell\CompilewithDLC\command]
@="C:\\dl\\DLC.exe \"%1\""

[HKEY_CLASSES_ROOT\DLSource\shell\OpeninDLI]
@="Open in DLI"

[HKEY_CLASSES_ROOT\DLSource\shell\OpeninDLI\command]
@="C:\\dl\\DLI.exe \"%1\""

Don't use spaces in the shell\commandname keys. Instead of shell\Compile with DLC and shell\Open in DLI use shell\CompilewithDLC and shell\OpeninDLI, and set their (Default) values to the actual strings you want to display.

To specify the default action set the ProgID\shell key's (Default) value to the appropriate command sub-key. So in this case you need to set the (Default) value of DLSource\shell to OpeninDLI.

As an alternative to directly editing the registry consider using something like FileTypesMan instead.

share|improve this answer
    
Thank you, it works. –  Disa Jul 6 '13 at 17:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.