天天看點

C# winform打開檔案夾并選中指定檔案

C# winform打開檔案夾并選中指定檔案

例如:打開“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");