importjava.awt.Desktop;importjava.io.File;importjava.io.IOException;public classLnkDemo {public static void main(String[] args) throwsIOException {
File f=new File("d://com.lnk");
System.out.println(f.exists());
System.out.println(f.isDirectory());
Runtime.getRuntime().exec("explorer /e,/select,"+f.getAbsolutePath());//Desktop.getDesktop().open(f);
}
}
摘要
本文讲述explorer.exe(资源管理器)的命令行。
语法
EXPLORER.EXE [/n][/e][,/root,][[,/select],]
/n: 默认选项,用我的电脑视图为每个选中的item打开一个单独的窗口, 即使该窗口已经被打开。
/e: 使用资源管理器视图。资源管理器视图和Windows 3.x的文件管理器非常相似。
/root,: 指定视图目录根,默认使用桌面作为根目录。
/select,: 选中指定对象。如果使用"/select" , 则父目录被打开,并选中指定对象。
例子
打开资源管理器视图并以C:\Windows为目录根浏览
explorer /e,/root,C:\Windows
打开资源管理器视图并选中Calc.exe
explorer /e,/select,c:\windows\system32\calc.exe
注意:/root和/select最好不要同时使用。
版权声明:本文为weixin_34353688原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。