By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,458 Members | 1,299 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,458 IT Pros & Developers. It's quick & easy.

Starting a process by extension association...

P: n/a
Hello,

From within a C# application I would like to start a process based upon the
default process associated with a specific file extension. For example, if I
provide File.doc as an argument, I want Word (or whatever application is
currently associated with .doc files) to start and open file File.doc. On
the other hand, if I provide File.wav as an argument, I want MediaPlayer (or
whatever application is currently associated with .wav files) to open and
used File.wav. I know how to use the Process class to start a specific
application, but what do I need to do to start an application with which a
particular extension is associated?

Thanks,
Ray
Jul 2 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 01 Jul 2008 21:40:01 -0700, Ray Mitchell
<Ra*****************@MeanOldTeacher.comwrote:
[...] if I provide File.wav as an argument, I want MediaPlayer (or
whatever application is currently associated with .wav files) to open and
used File.wav. I know how to use the Process class to start a specific
application, but what do I need to do to start an application with which
a
particular extension is associated?
By default, Process/ProcessStartInfo does just what you want. Just
provide the name of the file you want opened instead of an executable, and
Process will use the Windows shell to map the file type to the associated
application.

Pete
Jul 2 '08 #2

P: n/a


"Peter Duniho" wrote:
On Tue, 01 Jul 2008 21:40:01 -0700, Ray Mitchell
<Ra*****************@MeanOldTeacher.comwrote:
[...] if I provide File.wav as an argument, I want MediaPlayer (or
whatever application is currently associated with .wav files) to open and
used File.wav. I know how to use the Process class to start a specific
application, but what do I need to do to start an application with which
a
particular extension is associated?

By default, Process/ProcessStartInfo does just what you want. Just
provide the name of the file you want opened instead of an executable, and
Process will use the Windows shell to map the file type to the associated
application.

Pete
Thanks Pete,

I knew it had to be simple! I'll try it.
Jul 2 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.