0

We all know that windows has the feature that you can right click on a file and numerous options are shown. Well you can add a value to this menu. I followed this guide : jfitz.com/tips/rclick_custom.html

Basically I have a script that runs when I right click on a certain file type. Alright, so everything is going flawlessly, however when I finish and try to test it out Windows tells me that it only accepts .exe's.

Is their a way around this without having to use py2exe or something similar?

**EDIT Ok , so if my script takes the first argument as it's parameter how would I put this into the registry?

"C:\Python26\pythonw.exe C:\Users\daved\Documents\Python\backup.py "%1"" ?

1 Answer 1

1

yes, call pythonw.exe and pass the script path as a parameter

"C:\Python26\pythonw.exe" "C:\Users\daved\Documents\Python\backup.py" "%1"

It's also recommended (but not required) to use the extension .pyw when your script doesn't run in a console.

Sign up to request clarification or add additional context in comments.

1 Comment

While doing this on my own machine, I'd started experimenting with simply-- python.exe "C:\testFolder\test.py" "%1" -- and it worked perfectly (though it popped up a console window of course). Then I renamed my script to *.pyw, and switched the registry to-- pythonw.exe "C:\testFolder\test.pyw" "%1". For some bizarre reason, this caused Windows to pop up a missing-file-association dialog, citing "Log.txt" (my test file) as the one with no association. Cannot figure that one out at all! Anyway, when I switched to the fully-qualified pythonw.exe in quotes, it again worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.