Using Regedit for Context Menus

Discussion in 'other software & services' started by stryder83, Jun 16, 2005.

Thread Status:
Not open for further replies.
  1. stryder83

    stryder83 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    22
    Hi everyone,

    I've been looking for a way to manually program into Windows a specific syncronization on the My Documents folder. So far I have created the neccessary batch file to do this, but my problem lies with how I can insert a context menu option onto the My Documents folder.

    I know this is possible to do in the registry, but I am having extreme difficulty finding the appropriate key.

    Also, I'm wondering if anyone knows the exact syntax to add into the key value so that my batch file will run when I click the new context menu item.

    Thanks.
     
  2. Pieter_Arntz

    Pieter_Arntz Spyware Veteran

    Joined:
    Apr 27, 2002
    Posts:
    13,332
    Location:
    Netherlands
    Hi stryder 83,

    I found this for Windows 98
    Here: http://www.mvps.org/serenitymacros/mydocs.html

    Hope it helps you on your way.

    Regards,

    Pieter
     
  3. stryder83

    stryder83 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    22
    Thanks Pieter.

    Minus the "/AllSpecialItems" (I'm running XP Pro, does not have this key) I found the key I was looking for.

    I've successfully added the appropriate context menu item, but I am still boggled as to what the syntax is to insert the key value so that I can run a batch file. My batch file is called Synchro.bat, and it is found in the C:/ directory.
     
  4. Pieter_Arntz

    Pieter_Arntz Spyware Veteran

    Joined:
    Apr 27, 2002
    Posts:
    13,332
    Location:
    Netherlands
    Probably because the syntax that is a bit awkward

    It should look like this:
    @="C:\\Synchro.bat"

    with the double whatchamacallitgizmos :cool:

    Regards,

    Pieter
     
  5. stryder83

    stryder83 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    22
    I'm still not getting the action to occur. I think this may have to deal with the fact that the My Documents folder on the desktop (which is the folder I added the context menu item to) is actually just a special shortcut to the My Documents folder.

    Still, the context item IS there, so I believe I found the right key. The syntax appears to be right, but maybe I'm putting the value in wrong? I'm modifying the (Default) value in the key I created - do I need to add a new one instead? And if I do, do I add a String value, DWORD value, etc... ?
     
  6. Pieter_Arntz

    Pieter_Arntz Spyware Veteran

    Joined:
    Apr 27, 2002
    Posts:
    13,332
    Location:
    Netherlands
    I've been trying, but I can't get it to work either.

    I'll give you the regfile I used to add Register and Unregister as options when I rightclick on a dll.
    Code:
    REGEDIT4
    
    [HKEY_CLASSES_ROOT\dllfile\shell\Register]
    
    [HKEY_CLASSES_ROOT\dllfile\shell\Register\command]
    "(default)"="regsvr32.exe %1"
    @="regsvr32.exe \"%1\""
    
    [HKEY_CLASSES_ROOT\dllfile\shell\Unregister]
    
    [HKEY_CLASSES_ROOT\dllfile\shell\Unregister\command]
    "(default)"="regsvr32.exe /u %1"
    @="regsvr32.exe /u \"%1\" "
    Maybe this will help you along.

    Regards,
     
  7. que sera

    que sera Guest

    Hi,

    you might want to try rightclic on default and insert "C:\Synchro.bat" 1%


    this is how it works for me

    Regards,

    qs
     
  8. stryder83

    stryder83 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    22
    From looking at other shells (such as the My Computer desktop icon shell) I've noticed a similarity in sub keys.

    Each one (along with Pieter's Register/Unregister keys) has a key and a sub key - the key being named the title given to the added context item, and the sub key being named Command.

    Pieter, when you added your Register/Unregister, did you use a specific type of value? Such as DWORD or String?

    And the 1% seems to also be across the board - is this a variable given, or a switch?

    I tried Que Sera's idea, but still no avail. I've been trying to find out what the difference is between key values, because I think this may be the problem. Maybe still a syntax error?
     
  9. que sera

    que sera Guest

    @ stryder83

    http://img108.echo.cx/img108/240/synchrobat7zi.th.gif

    I created the subkeys in the left panel and then changed the default value in the right panel as shown above, but I'm using Windows Me, maybe it's different on XP?

    Sorry if this doesn't work for you.

    Regards,

    qs
     
  10. stryder83

    stryder83 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    22
    I finally got it!

    The only thing I was missing was that the initial key, which I called Synchronize, was merely just to name the item in the context menu. You need to add a sub key called Command (not sure if the name makes a difference) and this sub key is where you define the key value. For future reference, the keys go as follows for Windows XP Pro;

    {HKEY_CLASSES_ROOT\CLSID\450D8FBA-AD25-11D0-98A8-0800361B1103/shell}
    * - Under this key, right click and select New -> Key ; name the key what you want to call the item you're adding to the context menu
    * - Select this key, and add another key as you did above
    * - Select this new "Sub-Key" and in the right panel, right click (Default) and select Modify
    * - When the pop-up menu appears, enter the value exactly as shown below;

    "C:\Synchro.bat" 1%


    This linked the batch file called Synchro.bat from the file path C:\ to the newly added context menu item. For those that may have forgotten, this is to add an item to the My Documents context menu on the desktop. This DOES NOT add an item to the actual My Documents folder, but only the one found on the desktop.

    Thanks to Pieter and Que Sera for their help in finding the solution. :cool:
     
Loading...
Thread Status:
Not open for further replies.