Windows资源管理器右击文件和文件夹的上下文菜单 [英] Windows Explorer right click context menu for files and folders
问题描述
我的问题类似于这,但是没有提供我需要的所有信息,或者我不太明白。
我想要
我添加了键:
code> HKLM / SOFTWARE / Classes / * / shell / MyApp / command:C:\\path\\ test.exe%1
HKLM / SOFTWARE / Folder / shell / MyApp / command:C:\\path\\ test.exe%1
测试代码:
#include< iostream>
int main(int argc,char * argv [])
{
for(int i = 1; i std :: cout<< argv [i]<< \r\\\
;
system(pause);
return 0;
}
这可以正常工作,但...如果我标记几个文件/文件夹并右键点击并选择我添加的选项,许多测试应用程序启动。
这不是我想要的行为,我想所有的路径将被传递到我的单个实例应用程序列为 argv
,是否有人知道如何做?
BTW。我用 C ++
编码,但我认为这不是因为它是与Windows shell的业务。
感谢。
我认为正确的方法是写 ContextMenuHandler 并注册为shell扩展。
上下文菜单处理程序已在
键下注册 HKEY_CLASSES_ROOT\ * \shellex\ContextMenuHandlers
SO已经:
从C#上的Windows shell上下文菜单中获取多个文件(参数) / p> my question is similar into this, but that didn't gave all info I need, or I didn't understand that very well. I want that in file context menu there would be option to notify my app. I added keys: Code of test: This works fine, but... If I mark a few files/folders and right click and select my added option, many test apps launches. This is not the behaviour I want, I want that all paths would be passed into single instance of my app as list of BTW. I'm coding with Thanks. I think the right way is to write ContextMenuHandler and register it as shell extension. You can find lot of samples like here, here or here Context menu handlers are registered under key There are similar questions on SO already: How to pass in multiple file/folder paths via a rigth-click event(verb) to an executable? How to Pass MULTIPLE filenames to a Context Menu Shell Command? Windows context menu for multiple files [C++] Taking multiple files (arguments) from Windows shell context menu on C# 这篇关于Windows资源管理器右击文件和文件夹的上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!HKLM/SOFTWARE/Classes/*/shell/MyApp/command::"C:\\path\\test.exe" "%1"
HKLM/SOFTWARE/Classes/Folder/shell/MyApp/command::"C:\\path\\test.exe" "%1"
#include <iostream>
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; ++i)
std::cout << argv[i] << "\r\n";
system("pause");
return 0;
}
argv
's, does anyone knows how to do that?C++
but I think it isn't matter as it is business with Windows shell.HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers