Python: 'Right click' a file in File Explo

2019-08-16 07:03发布

问题:

My goal is to be able to 'right click' a file in file explorer, bring up the context menu and 'left click' to select an option from that menu.

My, so far unsuccessful idea, has been to use os.system to get into command prompt

from os import system

system(r'cd C:\Users\UserName\Documents && RIGHT CLICK SOME DOCUMENT AND SELECT AN OPTION')

But my idea falls short after the && in the above raw string. Where usually just putting a filename e.g. 'doc.txt' after the && would left click and open the file, I want to right click.

I realise that my solution so far is not strictly python related but an issue with the command line.

However I'm very open to and would be very appreciative of pointers towards a python module that might help.

(I'm talking about Windows 10 command line here)

Thanks!