Keeping DOS prompt/command window open (was [Tutor] pausing and layout)

Poor Yorick gp@pooryorick.com
Sat Jan 4 10:21:01 2003


mike O wrote:

>
>
> Also, how do you get python (when you don't run it in DOS Prompt) to 
> not auto-exit? I have made a few simple programs, but as soon as it 
> shows the answer, it exits.
>
>
I've never seen my method of doing this posted, which is to opend python 
using cmd.exe /k.  Here are the details for Windows 2000 (same concept 
should work on any version of Windows):

 From Windows explorer, go to Tools - Folder Options - File Types

Select the ".py" extension and click "Advanced"

In the "Edit File Type" window, click "New"

In the action field,  type in something descriptive, like "Run and remain"

In the "Application used to perform action" field, add the following line:

cmd.exe /k C:\Python22\python.exe "%1" %*

click "OK"

If you want to, set your new action as the default action.

Your new action will now be available on the menu when you right-click. 
 If it is the default action, it will trigger when you double-click on a 
.py file.

You can also accomplish this same thing by making a shortcut to your 
Python executable and then adding command-line parameters to the shortcut.


Poor Yorick
gp@pooryorick.com