Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get path of selected files in Windows explorer using python

Tags:

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.

I know how to trigger the script by key combination press ,but I have a problem with files path

Any help will be appreciated

like image 971
user3210523 Avatar asked Nov 22 '25 17:11

user3210523


1 Answers

I understand pyHook just reads the low level keyboard events. 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. For this you need shell extension. You can use pywin32 to create them in Python. Here's the documentation to get you started.

like image 95
Cu3PO42 Avatar answered Nov 25 '25 07:11

Cu3PO42