Adding context menu option through Python
Question: I'm trying to make a small Python script that is executed by clicking an
option in a file's context menu. It would execute something like
"path_to_script %L", where %L is (I think) the location of the file the user
has right-clicked. I know I have to add something to the registry for that
option to appear, but _winreg is getting confusing. What do I have to do to
add a registry entry (through Python) so my script can be called like that?


Answer: I dont know how you can remove from registry (probably manually or _winreg)
but you can follow a way like that per your custom python script to
registration to windows.

**registerOne.reg**

    
    
    Windows Registry Editor Version 5.00
    [HKEY_CLASSES_ROOT\*\shell\One]
    [HKEY_CLASSES_ROOT\*\shell\One\command]
    @="python.exe one.py \"%1\""
    

**one.py**

    
    
    def registerScriptToContextMenu ():
        # http://support.microsoft.com/kb/310516
        cmdLine = 'regedit.exe registerOne.reg'
        import os
        os.system(cmdLine)
    
    def one_main (*args):
        pass
    

