[HOWTO] Launching python from Windows Explorer

TMGB bennettt at am.appstate.edu
Tue Aug 31 16:04:36 CEST 1999

The post below probably could be replicated in Windows 95 and Windows
98.  As an alternative, you can put an executable or shortcut in the
"\windows\sendto" folder.  When you right click on any file you can move
your mouse down to the Send To option and a menu will pop out to the
side listing available applications to "Send to" (ie. all the files in
the sendto folder).  In this way you can creat a shortcut to python.exe
and edit the commandline under properties like the ones below.  I
haven't tested this particularly with python but I have customized the
sendto directory with all executables that I want available from a right
click.  This would even allow you to right click on a python file on the
desk top and run it in case it is something you run often and want
readily available.


Jeffrey Kunce wrote:
> I've had several requests to elaborate on an earlier post.
> Perhaps someone could check this, and add to an appropriate FAQ.
> These procedures are for NT, there may be minor differences for Win9x.
> To easily run/open python scripts from the windows explorer,
> I define several "actions" for .py files. Once these actions
> are defined on a machine, you can right-click on a python script,
> and choose the action you want to happen.
> Action Name: test
> Application: "C:\Program Files\Python\python.exe" -i "%1"
> Description: Runs the python script in an MSDOS window. Leaves
> the window open, and the interpreter running, when the script
> finishes. Good for debugging, esp when using the pdb module.
> Action Name: wordpad
> Application: "C:\Program Files\Windows NT\Accessories\wordpad.exe" "%1"
> Description: Opens the python script for editing in wordpad.
> Action Name: idle
> Application: "C:\Program Files\Python\pythonw.exe" "C:\Program Files\Python\Tools\idle\idle.pyw" "%1"
> Description: Opens the python script for editing/running in Idle. Each time
> this action is used, it will open a new instance of Idle. To open additional scripts,
> use Idle's File/Open command.
> To define an action for a ".py" files:
>   -open Windows [NT] Explorer
>   -from the "View" menu, select "Options"
>   -select the "File Types" tab
>   -from "Registered File Types", select "Python File"
>   -click the "Edit" button
>   -click the "New" button
>   -for "Action", enter the action name to be
> displayed in the popup menu
>   -for "Application used", enter the command
> line (as in the examples above)
>   -click "OK", etc...
> Variations of this process will edit existing
> actions, or define actions for new file types.
>   --Jeff

Thomas McMillan Grant Bennett           Appalachian State University
Computer Consultant II                  University Library
bennettt at am.appstate.edu               
Voice:  828 262 6587			FAX:    828 262 3001

Windows 95 is a 32-bit extension to a 16-bit patch for an 8-bit
operating system that was originally coded for a 4-bit microprocessor.
 - Chris Dunphy     Boot Magazine

More information about the Python-list mailing list