简体   繁体   English

使用python在Windows资源管理器中获取所选文件的路径

[英]Get path of selected files in Windows explorer using python

I would like to select some files on my desktop and then using python script(that will be launched by keyboard combinatoion pressing) get path of all selected files. 我想在我的桌面上选择一些文件,然后使用python脚本(将通过键盘组合按下启动)获取所有选定文件的路径。

I know how to trigger the script by key combination press ,but I have a problem with files path 我知道如何通过按键组合按下来触发脚本,但我的文件路径有问题

Any help will be appreciated 任何帮助将不胜感激

I understand pyHook just reads the low level keyboard events. 我理解pyHook只是读取低级键盘事件。 What you want to do is not possible with your approach. 您的方法无法实现您想要做的事情。 You need to get the Windows Explorer to actually tell you the paths you want to know, it needs to invoke the script itself. 您需要让Windows资源管理器实际告诉您想要知道的路径,它需要调用脚本本身。 For this you need shell extension. 为此你需要shell扩展。 You can use pywin32 to create them in Python. 您可以使用pywin32在Python中创建它们。 Here's the documentation to get you started. 这是帮助您入门的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM