Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

contextmenu - How add context menu item to Windows Explorer for folders


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In the registration editor (regedit.exe) find:

  • Context menu for right click on folders in left panel of Windows Explorer or on background of a directory in right panel:
  1. HKEY_CLASSES_ROOTDirectoryBackgroundshell if you are administrator
  2. HKEY_CURRENT_USERSoftwareClassesdirectoryBackgroundshell if you are a normal user
  • Context menu for right click on folders in right panel of Windows Explorer:
  1. HKEY_CLASSES_ROOTDirectoryshell if you are administrator
  2. HKEY_CURRENT_USERSoftwareClassesdirectoryshell if you are a normal user
  • Context menu for any file:
  1. HKEY_CLASSES_ROOT*shell if you are administrator
  2. HKEY_CURRENT_USERSoftwareClasses*shell if you are a normal user

In all cases:

  1. add a new key under shell, naming it as you want to name the context menu item
  2. add a new key inside this key, named command (mandatory name)
  3. edit the default property in command to myprogrampathpathpathexecutable.exe "%1" to pass the file path and name of the selected file to your custom program (for .../Directory/Background and .../directory/Background cases use %V instead of %1)

More customization:

  • Add icon: add a string value named icon for key created at step 1 with value matching an icon resource path. You can also provide an integer arguments to specify which icon to use. Example: %SystemRoot%System32shell32.dll,3
  • Display only on shift-click: add an empty string value named Extended for key created at step 1
  • Customize menu entry label: change the value of default value for key created at step 1
  • Change menu entry location: add a string value named Position with one of: Top, Bottom

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...