从Windows上下文菜单接收参数 [英] Receiving arguments from Windows Context menu

查看:205
本文介绍了从Windows上下文菜单接收参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前做过这个,但对我的生命不记得如何做到这一点...

I have done this before but for the life of me can't remember how to do this...

在我的右键菜单我添加了一个新条目(去REGEDIT ...查看HKEY_CLASSES_ROOT ...唧唧歪歪)...现在,当我点击我的选择我想在文件路径,文件名来传递,这种事情我的应用程序和...然后用它呢?

In my explorer context menu I added a new entry (go to regedit...go to HKEY_CLASSES_ROOT...bla bla bla)... Now when I click on my option I want to pass in the file path, file name, those kind of things to my application...and then use it there?

推荐答案

在.ext\shell\open\command键的默认值应包含路径您的.exe用%1的说法。资源管理器替代,随着完整路径文件。您可以通过在main()方法的参数或Environment.GetCommandLineArgs()在您的.exe阅读。

The default value of the .ext\shell\open\command key should contain the path to your .exe with the "%1" argument. Explorer substitutes that with the full path to the file. Which you can read in your .exe through the Main() method argument or Environment.GetCommandLineArgs().

这篇关于从Windows上下文菜单接收参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆