C#实现打开文件或文件夹及选中文件

发布时间:2017-09-22编辑:佚名阅读(2379)

打开文件夹:

System.Diagnostics.Process.Start(FilePath);

打开文件夹中某个文件:

System.Diagnostics.Process.Start(FilePath "/" FileName);


打开文件夹并选中单个文件:

System.Diagnostics.Process.Start("Explorer", "/select,"  FilePath "\\" FileName);

System.Diagnostics.Process.Start("Explorer.exe", "/select,"  FilePath "\\" FileName);

用IE打开文件:

System.Diagnostics.Process.Start("Explorer",FilePath "\\" FileName);

System.Diagnostics.Process.Start("Explorer.exe",FilePath "\\" FileName);

注:(explorer,explorer.exe,select,不区分大小写,”/selecet,”其中”/,”都不能少,FilePath为文件路径不包含文件名)

扩展提示:可以采用 Application.StartupPath 获得应用程序所在的目录。


  关键字:C#打开文件或文件夹选中文件


上一篇:调试批处理

下一篇:Windows密钥

鼓掌

0

正能量

0

0

呵呵

0


评论区