C# winform打开文件夹并选中指定文件

来源:互联网 发布:单片机中断程序c代码 编辑:程序博客网 时间:2024/05/16 17:00

例如:打开“E:\Training”文件夹并选中“20131250.html”文件

System.Diagnostics.Process.Start("Explorer.exe", @"/select,E:\Training\20131250.html");

一句代码搞定!!!

扩展:

1)只打开文件夹:

System.Diagnostics.Process.Start("Explorer.exe", @"E:\Training");

2)打开文件夹并选中文件夹

System.Diagnostics.Process.Start("Explorer.exe", @"/select,E:\Training\test.txt");

0 0