Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.


Go Back   Vista Forums > Misc Newsgroups > PowerShell

RB

Vista - file associations launching new cmd.exe

Reply
 
05-03-2007   #1 (permalink)
alvion


 

file associations launching new cmd.exe

I have .py files associated with the python2.4 interpreter, and when I try to
run one in cmd.exe, it correctly launches python within my current command
line, and displays the results as it would any console command.

However, when attempting the same thing within PowerShell, it launches a new
window to run the program. Running python.exe directly with the file name as
an argument, it works fine. For example:

test.py -- Will launch a new window
python test.py -- Will launch test.py within current window

I'm not sure whether this is a windows file association or powershell
problem, but it is a problem nonetheless. I have the "open" verb for the .py
file association set to: c:\Python24\python.exe "%1" %*

Thanks.

My System SpecsSystem Spec
05-04-2007   #2 (permalink)
Ryan Milligan


 

Re: file associations launching new cmd.exe

Looks like Powershell uses ShellExecute when invoking a file whose extension
isn't in the PATHEXT environment variable, which is what causes that extra
window to open. If you add .PY to PATHEXT, Python files should run in the
existing window.

-- Ryan Milligan

"alvion" <alvion@discussions.microsoft.com> wrote in message
news:094715F1-5A9F-4347-B4EB-56396BCB148D@microsoft.com...
>I have .py files associated with the python2.4 interpreter, and when I try
>to
> run one in cmd.exe, it correctly launches python within my current command
> line, and displays the results as it would any console command.
>
> However, when attempting the same thing within PowerShell, it launches a
> new
> window to run the program. Running python.exe directly with the file name
> as
> an argument, it works fine. For example:
>
> test.py -- Will launch a new window
> python test.py -- Will launch test.py within current window
>
> I'm not sure whether this is a windows file association or powershell
> problem, but it is a problem nonetheless. I have the "open" verb for the
> .py
> file association set to: c:\Python24\python.exe "%1" %*
>
> Thanks.



My System SpecsSystem Spec
Reply

RB


Thread Tools


Similar Threads for: file associations launching new cmd.exe
Thread Forum
File Associations Vista General
Lame Message Launching A .doc File Attachment in Windows E-Mail Vista General
File Associations Vista General
Pre-rc1 launching iso file Vista General
Pre-rc1 launching iso file Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd