Running a script from a windows right click menu..?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Jun 28 14:35:45 EDT 2009


En Sun, 28 Jun 2009 10:45:49 -0300, Nuff Nuff <nuffnough at gmail.com>  
escribió:

> I wrote a little script that affects a bunch of files in the folder
> that it is run in.
>
> Now what I want to do is to make it run from the right click menu but
> I don't know how.
>
> Would you give me an example script that will simply print the
> woriking directory,  and show me how to add that to the right click
> menu in windows explorer?

In the Windows registry, add a new key under  
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell
Make its default value the item text you want in the context menu.
Add a new key under it, "command", and make its default value the command  
line you want to execute. Will look like this:
"path to python.exe" "path to your script.py" %1 %*

See http://msdn.microsoft.com/en-us/library/dd807139(VS.85).aspx for more  
details

-- 
Gabriel Genellina




More information about the Python-list mailing list