加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

打开一个文件夹,并使用WPF突出显示一个特定的文件

发布时间:2020-12-13 20:49:58 所属栏目:Windows 来源:网络整理
导读:有没有办法启动资源管理器窗口并使用WPF突出显示该文件夹中的文件?我已经尝试过以下操作: Process ExplorerWindowProcess = new Process();ExplorerWindowProcess.StartInfo.FileName = "explorer.exe";ExplorerWindowProcess.StartInfo.Arguments = Confi
有没有办法启动资源管理器窗口并使用WPF突出显示该文件夹中的文件?我已经尝试过以下操作:
Process ExplorerWindowProcess = new Process();

ExplorerWindowProcess.StartInfo.FileName = "explorer.exe";
ExplorerWindowProcess.StartInfo.Arguments = ConfigFile.File.FullName;

ExplorerWindowProcess.Start();

…但是在Windows资源管理器中打开文件(在我的例子中是一个XML文件)与默认应用程序,我非常不希望。我知道Eclipse可以使用的Aptana工具允许您在Eclipse项目浏览器中选择一个文件,并在Explorer中完全按照我的要求显示文件,但是我需要一种在WPF应用程序中实现的方法。

Explorer命令行参数
http://support.microsoft.com/kb/152457
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]

/n                Opens a new single-pane window for the default
                  selection. This is usually the root of the drive Windows
                  is installed on. If the window is already open,a
                  duplicate opens.

/e                Opens Windows Explorer in its default view.

/root,<object>    Opens a window view of the specified object.

/select,<object>  Opens a window view with the specified folder,file or
                  application selected.

你也可以像这样在文件名上放置引号:

startInfo.FileName = "explorer.exe";
startInfo.Arguments = "/select,"" + ConfigFile.File.FullName + """;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读