I am trying to figure out how to make a python program open a file when a user right clicks on the file and selects "Open With". For example, I want a user to be able right click on a text file and to select my program so that my program can process the text file. Is the name of the text file passed into my program someway? Thanks.
My approach is to use a redirect .bat file containing python someprogram.py %1
. The %1
passes the file path into the python script which can be accessed withfrom sys import argv
argv[1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With