C#打开文件资源管理器

需求

需要打开windows的文件资源管理器进行浏览文件。

 

方法

利用命令提示符(cmd)中输入explorer.exe命令即可打开文件资源管理器

 

代码实现

1.引用

using System.Diagnostics;

 

2.打开资源管理器并选中该文件

            Process p = new Process();
            p.StartInfo.FileName = "explorer.exe";
            p.StartInfo.Arguments = @" /select, C:\Users\RAPOO\Pictures\Camera Roll\wuhan.jpg";
            p.Start();

效果如图所示:

 

3.直接打开该文件

            Process p = new Process();
            p.StartInfo.FileName = "explorer.exe";
            p.StartInfo.Arguments = @" C:\Users\RAPOO\Pictures\Camera Roll\wuhan.jpg";
            p.Start();

效果是利用windows默认的方式打开当前指定的内容。

 

posted on 2016-09-07 11:06  wangyblzu  阅读(8285)  评论(0编辑  收藏  举报

导航