Using Python scripts in Windows Explorer

Thomas Heller theller at ctypes.org
Fri Oct 20 15:53:01 EDT 2006


Ben Sizer schrieb:
> 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?
> 
I think you can create a shortcut to the Python script, and then drag files on it.

Thomas




More information about the Python-list mailing list