您的位置:首页 > 编程语言 > Java开发

学习记录——【转】java中打开explorer

2010-05-29 18:00 567 查看
很我找了好久 终于找到了.....

以下是转文:

//--------------------------------------------------------------------------------------------------

方法很简单,调用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.

本文来自CSDN博客:http://blog.csdn.net/denlee/archive/2007/04/23/1575961.aspx

//--------------------------------------------------------------------------------------------------

以上是原文 下面是个人尝试

举个例子:
Runtime.getRuntime().exec(
"rundll32 SHELL32.DLL,ShellExec_RunDLL " +
"Explorer.exe /select," + “c:/”);


这样就打开C盘了 ,经试验 那几个dll文件也可以不添加 直接写:

Runtime.getRuntime().exec( "Explorer.exe /select," + "c:/");也行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: