How can I add a custom file association in Windows 10

1

My concrete case is that I'm using Oracle VirtualBox and I want to be able to right-click the .vdi file and have the option "Compact" in the list (next to things like "delete", "send to mail", "send to zip", "open with", etc.).

I don't need help on how to compact a .vdi file. I know the shell command to do that. But I want to be able to do it without typing commands and use the context menu instead.

I searched all around the internet and found a tremendous amount of incomplete, outdated or contradictory information and I'm just lost.

Pascal Rottier

Posted 2018-03-08T21:44:45.610

Reputation: 11

Answers

4

This is exactly what you're looking for.

Adding a new command to context menu of specific file type:

Walkthrough:

  1. Open regedit and go to HKEY_CLASSES_ROOT\.vdi.
  2. Check the value of .vdi ((Default)), lets call it vdi-val.
  3. Navigate to HKEY_CLASSES_ROOT\vdi-val\shell.
  4. Create a new key named by your choice, this is the string that you'll see in the context menu. Lets call it Compact vdi.
  5. Under Compact vdi create another key named command.
    • Now you're in the path HKEY_CLASSES_ROOT\vdi-val\shell\Compact vdi\command.
  6. Set the default value to your program location with %1 as a parameter - it's the file path.
    • For example, C:\dev\compact_vdi.exe %1

Extra:

  • If you want to show this option only when holding Shift
  • If you want to apply this to all files - put your Command Title\command under HKEY_CLASSES_ROOT\*\shell

More in the source:

  • Add context menu item to desktop context menu.
  • Add to folder menus
  • Creating a .reg file to do the changes.

arieljannai

Posted 2018-03-08T21:44:45.610

Reputation: 1 913

Thanks. If only Google would have given me that link (or if only I knew the right combination of keywords to lead me there) – Pascal Rottier – 2018-03-08T22:20:24.243

We always appreciate the contributions from our community members, but please do not provide answers that are only a hyperlink. While the information may be valuable, if the source web page ever goes offline the answer is essentially useless. Quote all of the pertinent excerpts from the article within your answer, then you can still provide the hyperlink to cite your source. Please see the following article from our Help Center: How do I write a good answer? Thanks for your help!

– Run5k – 2018-03-09T01:52:50.310

@Run5k Thanks for the feedback - I've updated my answer :) – arieljannai – 2018-03-09T15:48:38.340