如何自动根据文件扩展名来启动相应的应用程序加载文件?

来源:互联网 发布:网络歌手邓小龙资料 编辑:程序博客网 时间:2024/04/24 18:52

如何自动根据文件扩展名来启动相应的应用程序加载文件?

' 指定所要打开的文件。        

Dim myFile As String = Environment.CurrentDirectory & "/Text.txt"

        ' 建立一个新的 ProcessStartInfo 结构。

         Dim pInfo As New ProcessStartInfo

        ' 指定定所要启动的文件。

         pInfo.FileName = myFile

        ' UseShellExecute 的默认值就是 True

        pInfo.UseShellExecute = True

        ' 启动进程。

         Dim p As Process = Process.Start(pInfo)