can someone help me combine these two .reg into a context menu flyout?

Page 1 of 3 123 LastLast

  1. Posts : 681
    Windows 10 x64 Pro
       #1

    can someone help me combine these two .reg into a context menu flyout?


    so i have a few reg files that ive been basically taking turns importing back and forth.

    they do what i need them to but id like to have them both present at once as a context menu entry "Restore Ownership" with a submenu like "Restore to SYSTEM" and "Restore to TrustedInstaller" or some such.

    this'll also serve as a template/example for me going forward, so theres that :)

    Code:
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
    @="Restore Ownership"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership]
    @="Restore Ownership"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"

    and


    Code:
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
    @="Restore Ownership"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership]
    @="Restore Ownership"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
      My Computer

  2. Anak's Avatar
    Posts : 1,252
    10 Home 64-bit | v2004 | Build - 19041.685 - See other Info below
       #2

    Hi Klepp,

    This might do what you want: Add or Remove Items in Send To context menu in Windows But I don't believe it will set up; It might if you set up the cmds in a folder/sub-folder format then add them to send-to.
      My Computers

  3. Edwin's Avatar
    Posts : 17,029
    Windows 10
       #3

    Add 'SubCommands' then 'shell' then 'flyouts'...

    can someone help me combine these two .reg into a context menu flyout?-000170.png

    can someone help me combine these two .reg into a context menu flyout?-000171.png
      My Computer


  4. Posts : 681
    Windows 10 x64 Pro
    Thread Starter
       #4

    Thanks edwin, got'er done.

    For future use.

    Code:
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
    "HasLUAShield"=""
    "MUIVerb"="Restore Ownership"
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    "SubCommands"=""
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell]
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM]
    "HasLUAShield"=""
    "MUIVerb"="Restore to System"
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller]
    "HasLUAShield"=""
    "MUIVerb"="Restore to TrustedInstaller"
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership]
    "HasLUAShield"=""
    "MUIVerb"="Restore Ownership"
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    "SubCommands"=""
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell]
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM]
    "HasLUAShield"=""
    "MUIVerb"="Restore to System"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller]
    "HasLUAShield"=""
    "MUIVerb"="Restore to TrustedInstaller"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    enable_restore_ownership_context_menu.reg

    disable_restore_ownership_context_menu.reg

    - - - Updated - - -

    well, sort of resolved. not working as intended.

    i get "this security ID may not be assigned as the owner of this object. hrmm... the never ending struggle. I think its due to not launching the cmd as admin, now i ahve to figure that out :P

    - - - Updated - - -

    tried something like this for example to no avail either. harumph!

    Code:
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    - - - Updated - - -

    and while im here, someone do-tell; what on gods green earth is the trick to not having to go back and edit the code brackets every time so the stuff doesnt show up in a big long line and shows up formatted properly? lol
      My Computer


  5. Posts : 681
    Windows 10 x64 Pro
    Thread Starter
       #5

    HUGE ask. Help creating the regfile to end all regfiles


    Yea, im old. kids have abused my psyche. I cant wrap my head around this one.

    I was working on this earlier today

    Code:
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
    "HasLUAShield"=""
    "MUIVerb"="Restore Ownership"
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    "SubCommands"=""
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell]
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM]
    "HasLUAShield"=""
    "MUIVerb"="Restore to SYSTEM"
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller]
    "HasLUAShield"=""
    "MUIVerb"="Restore to TrustedInstaller"
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership]
    "HasLUAShield"=""
    "MUIVerb"="Restore Ownership"
    "NoWorkingDirectory"=""
    "NeverDefault"=""
    "SubCommands"=""
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell]
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM]
    "HasLUAShield"=""
    "MUIVerb"="Restore to SYSTEM"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipSYSTEM\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"SYSTEM\" /t /c & pause"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller]
    "HasLUAShield"=""
    "MUIVerb"="Restore to TrustedInstaller"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\RestoreOwnership\Shell\RestoreOwnershipTrustedInstaller\command]
    @="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    "IsolatedCommand"="cmd.exe /c icacls \"%1\" /setowner \"NT Service\\TrustedInstaller\" /t /c & pause"
    It works except it doesnt. It seems the command needs to be ran elevated. it appears this can be worked around by using the runas key, which would be a small adjustment to make (if that is in fact the case)

    however, I want to take it one step further as this would clutter up my context menu with multiple entries surrounding the same area of operation so to speak.

    @Brink had done some work for a fellow that is in the same vein of what im trying to accomplish here Add Reset Permissions to Context Menu in Windows

    Im looking to have a context menu simply called Ownership that fly's out and includes the same Take Ownership we all know and love, followed by Restore Ownership which flies out into the two entries I indicated at the beginning of my post. Restore to SYSTEM and Restore to TrustedInstaller.

    Where this becomes extra sketchy for me is the (assumed?) requirement of the runas key to get those restore ownership commands to work elevated. Unless theres another means? Either way this surpasses my rudimentary acumen at this point.

    anyone able to bring my dream into a reality, or get those commands to run elevated without using runas and then I think I can slowly muscle something together by looking at examples? lol.
      My Computer

  6. Brink's Avatar
    Posts : 56,203
    64-bit Windows 10 Pro for Workstations build 21354
       #6

    Hello mate, you could test the commands below based on the .reg files I used in the Take Ownership tutorial below to run the command elevated. The commands below will only change the owner though and not permissions.

    Of course, you must be careful about not changing the owner of items that were not originally System or Trusted Installer since it could prevent access.

    Add Take Ownership to Context Menu in Windows 10

    Change owner to System
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner "SYSTEM" /t /c & pause' -Verb runAs\""
    "IsolatedCommand="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner "SYSTEM" /t /c & pause' -Verb runAs\""

    Change owner to Trusted Installer
    Code:
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner "NT Service\\TrustedInstaller" /t /c & pause' -Verb runAs\""
    "IsolatedCommand="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner "NT Service\\TrustedInstaller" /t /c & pause' -Verb runAs\""
      My Computers


  7. Posts : 681
    Windows 10 x64 Pro
    Thread Starter
       #7

    hrm. i used something VERY similar earlier today here can someone help me combine these two .reg into a context menu flyout?

    will have to compare and see whats different. If those do in fact work, then I can avoid that runas key as a cursory glance makes it look like that may be impossible to do what im trying to do using it anyways.

    This'll likely take me the rest of the evening, but ill report back and should I get it functional - report back w/ the .reg files for future "gluttons for punishment" :P

    - - - Updated - - -

    well, its looking like 1 errant backslash potentially. Except for i cant test, because those wont even import.... any ideas?
      My Computer

  8. Brink's Avatar
    Posts : 56,203
    64-bit Windows 10 Pro for Workstations build 21354
       #8

    Here's an example for a single context menu tested and working.

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnershipSYSTEM]
    @="Restore SYSTEM Ownership"
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnershipSYSTEM\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""

    Give me a few minutes to test an expandable one for SYSTEM and TrustedInstaller.
      My Computers


  9. Posts : 681
    Windows 10 x64 Pro
    Thread Starter
       #9

    yep, that by itself tested and working.

    feel free to use my template for expansion. Unless that is where the hangup lay. I assume it was in the command though.

    i appreciate the time sincerely. At my age im acutely aware of the value of it, so to be spending it on helping people is commendable <3
      My Computer

  10. Brink's Avatar
    Posts : 56,203
    64-bit Windows 10 Pro for Workstations build 21354
       #10

    So far I have this, but still getting the message below for TrustedInstaller. More work......

    Invalid parameter "Service\TrustedInstaller"
    Press any key to continue . . .

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership]
    "MUIVerb"="Restore Ownership"
    "HasLUAShield"=""
    "SubCommands"=""
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipSYSTEM]
    @="Restore Ownership SYSTEM"
    "HasLUAShield"=""
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipSYSTEM\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"SYSTEM\" /t /c /l & pause' -Verb runAs\""
    
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipTrustedInstaller]
    @="Restore Ownership TrustedInstaller"
    "HasLUAShield"=""
    
    [HKEY_CLASSES_ROOT\*\shell\RestoreOwnership\shell\RestoreOwnershipTrustedInstaller\command]
    @="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"NT Service\\TrustedInstaller\" /t /c /l & pause' -Verb runAs\""
    "IsolatedCommand"="powershell -windowstyle hidden -command \"Start-Process cmd -ArgumentList '/c icacls \\\"%1\\\" /setowner \"NT Service\\TrustedInstaller\" /t /c /l & pause' -Verb runAs\""
      My Computers


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 23:55.
Find Us




Windows 10 Forums