0

大家早上好,

我有一个项目将作为 Excel 插件分发,它是用 C# 编写并使用 ExcelDNA。

我想做的是在我的加载项主窗体中添加一个链接标签,单击时,我希望它在特定索引处打开 Windows 资源管理器,例如 G:驱动器。

这可能吗?我看过一些例子,但无法解决它们,

提前致谢!

4

1 回答 1

1

绝对地:

来自微软知识库

   Option            Function
   ----------------------------------------------------------------------   
   /n                Opens a new single-pane window for the default
                     selection. This is usually the root of the drive that
                     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 program selected.

   Examples
   -----------------------------------------------------------------------
   Example 1: Explorer /select,C:\TestDir\TestProg.exe
              Opens a window view with TestProg selected.

   Example 2: Explorer /e,/root,C:\TestDir\TestProg.exe
              Opens Explorer with drive C expanded and TestProg selected.

   Example 3: Explorer /root,\\TestSvr\TestShare
              Opens a window view of the specified share.

   Example 4: Explorer /root,\\TestSvr\TestShare,select,TestProg.exe
              Opens a window view of the specified share with TestProg selected.

因此,您可以调用Explorer /select,G:\yourfile以打开资源管理器并选择该文件/目录。

把那个电话放在Process.Start()等等瞧:)

于 2011-11-09T09:28:13.913 回答