How to add "Take Ownership" to folder & file context menus

I have added registry code for "How to Add Take Ownership to Context Menu in Windows 10" – https://www.tenforums.com/tutorials/3841-add-take-ownership-context-menu-windows-10-a.html .

It works fine when I take ownership in Windows Explorer, but in Dopus, the item "Take Ownership" has been automatically added only to context menus for drives, not for files or folders. And I have forgotten how to add items to these context menus.

I should remember. But a 120 feet tumble down a ravine slope and into its creek two weeks ago has muddled me a little. Now, honestly, and miraculously, I am unscathed, but, as I said, a little muddled.

Grateful for help on this.

Hans L

To add context menu items for files + folders, Settings > File Types > All Files and Folders > Context Menu.

Leo, thank you!

Now, next step, and I am in deep water here. I have the following for "Take Ownership"

HKEY_CLASSES_ROOT\*\shell\TakeOwnership\command

Default:

powershell
-windowstyle hidden -command "Start-Process cmd -ArgumentList '/c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-3-4:F /t /c /l' -Verb runAs"

IsolatedCommand:

powershell -windowstyle hidden -command "Start-Process cmd -ArgumentList '/c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-3-4:F /t /c /l' -Verb runAs"`

HKEY_CLASSES_ROOT\Directory\shell\TakeOwnership\command

Default:

powershell -windowstyle hidden -command "Start-Process cmd -ArgumentList '/c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-3-4:F /t /c /l /q' -Verb runAs"

Isolated Command:

powershell -windowstyle hidden -command "Start-Process cmd -ArgumentList '/c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-3-4:F /t /c /l /q' -Verb runAs"

The author of this code has put "Take Ownership" in Win Expl context menu, and when I have highlighted a folder or file, and click this option, I have ownership of the folder/file, and can, for instance, delete it even if I could not do it before. I do not know what the option "Take Ownership" does (probably calling one of the two registry items), and while i have asked the author, I am not sure what he will say. So, let me ask, what would I put in DOPUS' context menu for Files & Folders to run this stuff? If you know at all.

Hans L

Based on that, I would expect this to work (although I don't know why they are running it via powershell.exe when cmd.exe would do and launch faster):

powershell -windowstyle hidden -command "Start-Process cmd -ArgumentList '/c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-3-4:F /t /c /l' -Verb runAs"

Or this:

Or this:

So, I have created the buttons according to steje and context menu items according to Playful. Now,

• do context menu items work WITH the buttons or INSTEAD of the buttons?

• if WITH, can the button code be put in with the context item code? How?

Hans L

Buttons and context menu items are separate things.

Enter the code like this:


(I usually run these ownership commands from a .bat in an elevated shell - seems to work better)