Assigning keyboard shortcut to get path of selected item in windows explorer

家住魔仙堡 提交于 2020-01-21 10:28:12

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/2701298/assigning-keyboard-shortcut-to-get-path-of-selected-item-in-windows-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!