How do I launch files in C#

后端 未结 3 1561
感动是毒
感动是毒 2020-11-30 03:06

-Edit- I feel like an idiot. I had a feeling something like the answer below would work but didnt see any google results similar to the answers below. So when i saw this com

3条回答
  •  暖寄归人
    2020-11-30 03:55

    Use:

    System.Diagnostics.Process.Start(filePath);
    

    It will use the default program that would be opened as if you just clicked on it. Admittedly it doesn't let you choose the program that will run... but assuming that you want to mimic the behaviour that would be used if the user were to double-click on the file, this should work just fine.

提交回复
热议问题