早安全,
我有一个项目将作为Excel加载项分发,它是用C#编写的并使用ExcelDNA。
我想要做的是在我的加载项主窗体中添加一个linklabel,点击后,我希望在特定索引处打开Windows资源管理器,例如G:开车。
这可能吗?我已经看过一些例子但是无法纠结它们,
提前致谢!
答案 0 :(得分:1)
绝对:
来自Microsoft KB:
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()
et voila :)