简体   繁体   English

如何使用 C# 打开特定目录和 SELECT 特定文件

[英]How to open a particular directory and SELECT a particular file there using C#

In my existing program, after completing some result I store it in a file.在我现有的程序中,完成一些结果后,我将其存储在一个文件中。
I have the file(folder) path saved in a string var,我将文件(文件夹)路径保存在字符串 var 中,
I am seeking a way to open the same folder (not file directly) and in that explorer window, particular file must be selected!我正在寻找一种方法来打开同一个文件夹(不是直接文件),并且在那个资源管理器 window 中,必须选择特定的文件!
so that user can come to know which file has been created by the code.这样用户就可以知道代码创建了哪个文件。

This is what you are looking for.这就是你要找的。

You pass explorer.exe /select, filename你通过explorer.exe /select, filename

Opening a folder in explorer and selecting a file 在资源管理器中打开文件夹并选择文件

Here are some more command line options for explorer.exe以下是 explorer.exe 的更多命令行选项

And also look in to Process.Start Method.并查看 Process.Start 方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM