分配键盘快捷键以获取 Windows 资源管理器中所选项目的路径
我不知道这是否可能,但是如何将某些组合键绑定到(C#)程序,以便当在 Windows 资源管理器中选择某个文件时按下该键盘快捷键时,它会调用该路径的特定函数文件作为参数。
或者我可以分配一些键盘快捷键,以便 Windows 资源管理器在我的程序中打开选定的文件(这样我可以将路径传递给已经运行的实例)
谢谢
I don't know if this is even possible, but how can I bind some key combination to a (C#)program, so that when that keyboard shortcut is pressed with some file selected in windows explorer, it calls specific function with path of that file as a parameter.
Or can I assign some keyboard shortcut so that windows explorer opens selected file in my program(that way I could pass the path to already running instance)
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以修改程序以作为 shell 扩展运行,这会将程序的项目添加到 Windows 资源管理器中的右键单击菜单中,但显然用 C# 编写 shell 扩展是一个 坏 想法。
作为替代方案,只需做一点工作 AutoHotkey 就可以做到这一点。 这里是一个示例脚本,当按下某个键盘组合时,该脚本会重命名 Windows 资源管理器中的选定文件按下。您可以修改它以运行 C# 程序并传递选定的文件名。
You could modify your program to run as a shell extension which would add an item for your program to the right-click menu in windows explorer, but apparently coding shell extensions in C# is a bad idea.
As an alternative, with a little work AutoHotkey can do this. Here's a sample script that renames the selected file in Windows Explorer when a certain keyboard combination is pressed. You could modify it to run your C# program and pass the selected filename.