2011-11-09 62 views
0

早安所有,是否有可能從LinkLabel的打開Windows資源管理器

我有一個將被分配作爲一個Excel插件,它是用C#編寫,並使用ExcelDNA項目。

我想要做的是添加一個linklabel到我的加載項主窗體,點擊後,我想要打開一個特定索引的Windows資源管理器,例如。 G:驅動器。

這可能嗎?我見過一些例子,但一直沒有能夠糾纏它們,

在此先感謝!

回答

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()等調用瞧:)

+0

大加讚賞,忽略了這個!那些日子中的一天... –

相關問題