是否可以从链接标签打开Windows资源管理器?
本文关键字:Windows 资源管理器 标签 链接 是否 | 更新日期: 2023-09-27 18:14:00
大家早上好,
我有一个项目,它将作为一个Excel插件分发,它是用c#编写的,并使用ExcelDNA。
我想做的是添加一个链接标签到我的插件主表单,当点击时,我希望这打开windows资源管理器在一个特定的索引,例如G:驱动器。
这可能吗?我已经看到了一些例子,但还没有能够理清它们,
提前感谢!
绝对:
来自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
打开资源管理器,选择该文件/目录。
把call放到Process.Start()
中,瞧!)