如何使用java代码打开Windows文件浏览器并突出显示指定的文件? [英] How to use java code to open Windows file explorer and highlight the specified file?

查看:127
本文介绍了如何使用java代码打开Windows文件浏览器并突出显示指定的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在使用java Desktop API来操作文件资源管理器。
我知道如何打开文件资源管理器,但我不知道如何打开它并突出显示指定的文件。

I am now using java Desktop API to manipulate file explorer. I know how to open the file explorer but I don't know how to open it and highlight the specified file.

我们使用Chrome后,下载文件,我们可以选择在文件夹中显示来打开文件浏览器并突出显示下载的文件。

As we using the Chrome, after downloading files, we can choose "show in folder" to open the file explorer and highlight the downloaded file.

如何使用java Desktop API这样做?
或者java中是否有其他API可以实现此操作?

How to use java Desktop API to do so? Or is there any other API in java can realize this action?

推荐答案

使用: Runtime.getRuntime()。exec(explorer.exe / select,+ path);

如果有空格,这也有用在 PATH 中。

This also works if there is a space in the PATH.

这篇关于如何使用java代码打开Windows文件浏览器并突出显示指定的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆