Java如何打开一个文件夹并选中指定文件

来源:互联网 发布:iphoto mac 破解版 编辑:程序博客网 时间:2024/05/22 11:44


 很简单,调用explorer.exe就可以,
Runtime.getRuntime().exec(
                            "rundll32 SHELL32.DLL,ShellExec_RunDLL " +
                            "Explorer.exe /select," + targetDirectFileName);

 [Windows Explorer Switches]
 Windows Explorer switches are useful in creating rooted folders:
      Explorer [/e][,/root,<object>][[,/select],<sub object>]

 /e
    Use Explorer view (scope and results pane view). The default is
    Open view (results in pane view only).

 /root<object>
    Specify the object in the "normal" name space that is
    used as the root (top level) of this Explorer/Folder (i.e., local
    path or UNC name). The default is the Desktop).
 /Select
    The parent folder opens and the specified object is selected.
    <sub object>   Specify the folder unless /select is used. The
    default is the root. 

原创粉丝点击