Running associated application

Hello,
please can someone help me with running an associated application for some file from my application For example I've got a full path to some picture, lets say c:\picture.jpg and I want to run its associated program, let it be Paint. How should I do that
Thanks, michi.


Answer this question

Running associated application

  • Yitzhak Khabinsky

    hi,

    you can use process.start in system.diagnostics namespace

    System.Diagnostics.Process.Start("msPaint.exe",@"C:\Mypicture.bmp");

    but note i have a problem with the path if the folder name in the path contain spaces it will not work with paint brush, it works with other programs like notepad. example "documents and setttings", i don't know how to deal with that and i hope if someone can comment on that

    hope this helps



  • Pradeepkonda

    Probably you can use short type of folder names like in DOS. For example Documents and Settings would be Docume~1. About starting the default application associatated with some file extension, it is done automatically. If you start the picture file, then the associated application will be started.

    For example Process.Start(@"C:\picture.jpg");



  • Running associated application