[python-win32] how to open a file with associated application ?

James Carroll mrmaple at gmail.com
Thu Mar 2 23:13:28 CET 2006


Hi Michael,  Try this:

import os
os.startfile(r"C:\DEFORM3D\PROBLEM\test.KEY")

-Jim

On 3/2/06, Michael Li <mli at deform.com> wrote:
> hi,
>
> In Windows, there is a default way to open a file,
> like double click test.txt file, then Notepad will
> open the test.txt, double click test.doc, then
> MS-Word will open the test.doc.
>
> If I want to open a specific file, test.KEY,
> with my application, how do I do it ?
> The suffix ".KEY" is fixed.
> More specific, I have a file test.KEY in
> C:\DEFORM3D\PROBLEM\test.KEY
> my application is in C:\DEFORM3D\V6_0\DEF_GUI3.EXE,
>
> when double-click C:\DEFORM3D\PROBLEM\test.KEY,
> I want to open it like :
> C:\DEFORM3D\V6_0\DEF_GUI3.EXE -m pre -d C:\DEFORM3D\PROBLEM -i test -f
> test.KEY
>
> Can anyone point me a direction ?
>
> I believe that I have to write a python script to register
> something first. Is there any workable scripts I can borrow ?
>
>
>
> Best regards.
> Michael Li
>
> ==========
> This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipients, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>


More information about the Python-win32 mailing list