Using Python scripts in Windows Explorer

Ben Sizer kylotan at
Fri Oct 20 17:20:06 CEST 2006

I'd like to be able to drag a file onto a Python script in Windows
Explorer, or send that file to the script via the Send To context-menu
option, so I can then process that file via sys.argc.

Unfortunately, I can't drag items onto the Python script, because
Windows doesn't recognise that the script is executable (unless I
double-click it, upon which it runs as usual, without the command line
parameter of course) and won't set it as a drop target. And it won't
even appear in the Send To menu after the usual steps are taken to get
it there.

I then tried to wrap it in a batch file, but encounter a problem, where
that batch file is able to execute the Python file if I double-click
the batch file, but if I drag a file onto it it says it can no longer
find the Python script.

Are there any simple and workable solutions for this sort of thing?

Ben Sizer

More information about the Python-list mailing list