pspjhp
4th June 2013 14:30 UTC
NSIS Registry Key Overwriting Default Open In Context Menu
Hey everyone,
I know this is probably an easy fix , but I'm having some trouble with it. I create a couple keys so that when someone right clicks on a directory OR file my program shows up in the options. When you click the program option then the program is launched. Easy.
The problem is that these keys that I'm creating are making it so when I double click on a direcotyr or file that it launches my program. It is the default option for dealing with directorys/files instead of 'Open'. I would like it just to be like the 2nd or 3rd option or something after Open or Open in New Window.
Here is an example of my line of code:
WriteRegStr HKCR "Directory\shell\Context Menu Line\command" "" '"C:\\TestProgram.exe" "%1"'
Any help would be greatly appreciated.
Thanks!
Justin
Afrow UK
4th June 2013 15:21 UTC
The default value in the shell key will specify the default action. Its value should be set to "none".
WriteRegStr HKCR "Directory\shell" "" "none"
Stu
Anders
5th June 2013 00:25 UTC
Originally posted by Afrow UK
The default value in the shell key will specify the default action. Its value should be set to "none".
WriteRegStr HKCR "Directory\shell" "" "none"
Setting the default shell value to none is not a good idea AFAIK, do you know any MSDN docs that say otherwise?
If all you are doing is adding HKCR\Directory\shell\mything\command it should not get invoked as the default action. The context menu for a file system folder comes from 3 places (5 on XP+) HKCR\Folder, HKCR\Directory and HKCR\AllFilesystemObjects and you should never touch the default shell value because it can mess up the way explorer opens folders!
pspjhp
7th June 2013 12:51 UTC
Yeah I agree however, for some reason the default action becomes my program when I try to open anything up. Until I uninstall and then it goes back to the normal thing. I'm using Windows 7 if that changes anything. I could include a small screen shot or something of my context menu and/or registry if that helps.
pspjhp
7th June 2013 13:07 UTC
What it seems to be doing is putting the key at the top in the shell "folder"
so under the shell "folder" it displays:
My Program
removeproperties
don't know why it's installing it at the top.
Anders
7th June 2013 21:48 UTC
Maybe you could post the contents of a regedit exported .reg of HKCR\Directory?
You could also try adding a dword called NeverDefault under ..\shell\mything
Afrow UK
7th June 2013 23:37 UTC
Originally posted by Anders
Setting the default shell value to none is not a good idea AFAIK, do you know any MSDN docs that say otherwise?
"none" is the default value on Windows 7 and 8 (not checked below). Using an empty value rather than "none" changes the default action for folders to one of the commands listed in the registry key. This may be specific to the Directory shell commands list though.
Stu
Anders
8th June 2013 03:13 UTC
Originally posted by Afrow UK
"none" is the default value on Windows 7 and 8 (not checked below). Using an empty value rather than "none" changes the default action for folders to one of the commands listed in the registry key.
OK but since you should not touch the default anyway it is going to be whatever is correct for that version of Windows.
Originally posted by Afrow UK
This may be specific to the Directory shell commands list though.
This would be my guess as well...
pspjhp
18th June 2013 18:28 UTC
HKCR\Directory contents
So it looks like the software installs on other computers fine. I must have messed up my registry somehow, but not sure how... I'll also try out the DWORD thing...just worrisome of the possibility that it could occur on another person's machine. Here is the contents of my export. The 'Run Test Program' is the program that I'm running.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory]
[HKEY_CLASSES_ROOT\Directory\Background]
[HKEY_CLASSES_ROOT\Directory\Background\shell]
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""
[HKEY_CLASSES_ROOT\Directory\Background\shellex]
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\DropboxExt]
@="{FB314ED9-A251-47B7-93E1-CDD82E34AF8B}"
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\Gadgets]
@="{6B9228DA-9C15-419e-856C-19E768A13BDC}"
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\igfxcui]
@="{3AB1675A-CCFF-11D2-8B20-00A0C93CB1F4}"
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\New]
@="{D969A300-E7FF-11d0-A93B-00A0C90F2719}"
[HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\Sharing]
@="{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}"
[HKEY_CLASSES_ROOT\Directory\DefaultIcon]
@=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,73,00,68,00,\
65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,33,00,00,00
[HKEY_CLASSES_ROOT\Directory\shell]
[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""
[HKEY_CLASSES_ROOT\Directory\shell\find]
"LegacyDisable"=""
"SuppressionPolicy"=dword:00000080
[HKEY_CLASSES_ROOT\Directory\shell\find\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,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,65,00,78,00,\
65,00,00,00
"DelegateExecute"="{a015411a-f97d-4ef3-8425-8a38d022aebc}"
[HKEY_CLASSES_ROOT\Directory\shell\Run Test Program]
[HKEY_CLASSES_ROOT\Directory\shell\Run Test Program\command]
@="\"C:\\\\Program Files (x86)\\\\Justin HP\\\\My Test Folder\\\\Test Program.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\shellex]
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers]
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\AgentRansack]
@="{2AE9D6D8-E348-4853-B266-C78844D31B97}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\DropboxExt]
@="{FB314ED9-A251-47B7-93E1-CDD82E34AF8B}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\EncryptionMenu]
@="{A470F8CF-A1E8-4f65-8335-227475AA5C46}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Offline Files]
@="{474C98EE-CF3D-41f5-80E3-4AAB0AB04301}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\SavShellExt]
@="{A3A1D8A1-006D-4B93-BA27-6F6B4C9C4F1D}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Sharing]
@="{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}"
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]
[HKEY_CLASSES_ROOT\Directory\shellex\CopyHookHandlers]
[HKEY_CLASSES_ROOT\Directory\shellex\CopyHookHandlers\FileSystem]
@="{217FC9C0-3AEA-1069-A2DB-08002B30309D}"
[HKEY_CLASSES_ROOT\Directory\shellex\CopyHookHandlers\Sharing]
@="{40dd6e20-7c17-11ce-a804-00aa003ca9f6}"
[HKEY_CLASSES_ROOT\Directory\shellex\DragDropHandlers]
[HKEY_CLASSES_ROOT\Directory\shellex\DragDropHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers]
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\Offline Files]
@="{7EFA68C6-086B-43e1-A2D2-55A113531240}"
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\Sharing]
@="{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}"
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\{1f2e5c40-9550-11ce-99d2-00aa006e086c}]
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\{4a7ded0a-ad25-11d0-98a8-0800361b1103}]
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\{ECCDF543-45CC-11CE-B9BF-0080C87CDBA6}]
[HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\{ef43ecfe-2ab9-4632-bf21-58909dd177f0}]
@=""
thanks,
Justin
pspjhp
20th June 2013 15:52 UTC
Originally posted by Anders
Maybe you could post the contents of a regedit exported .reg of HKCR\Directory?
You could also try adding a dword called NeverDefault under ..\shell\mything
That totally worked! Adding the dword called NeverDefault! Thanks for that. I was just thinking, is there anyway to move it up the context menu so it's right under open or whatever the first default is? Just curious. This is more like micro-optimization, just have some programs that I installed in the context menu and it put my program underneath them all.
thanks again!
Justin