获取 Java 中文件的描述
Get the description of a File in Java
我想编写 Java 代码,以获取位于 Windows 服务器上的任何文件的描述。 Description 必须与文件中提到的相同,右键单击它然后单击 Properties。
例如,以下是文件:C:\Program Files\Google\Chrome\Application\chrome.exe
右键单击它,然后单击属性。说明是"Google Chrome".
请帮忙。
更新:
即使有人能给我一个方法来导出 Windows 任务管理器中显示的 "Description" 字段的数据,它也会帮助我。
检查 this - 它将 return the right-click-> details
一个文件。
你可以从 java 开始,像这样
try
{
String line=null;
String filePath="\"YOUR FILE PATH\"";
Process p = Runtime.getRuntime().exec("toolTipInfo.bat "+filePath);
String processDesc="";
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null)
{
if(line.contains("File description:"))
processDesc=line.split(":")[1].trim();
}
input.close();
}
catch(IOException e)
{
}
我想编写 Java 代码,以获取位于 Windows 服务器上的任何文件的描述。 Description 必须与文件中提到的相同,右键单击它然后单击 Properties。
例如,以下是文件:C:\Program Files\Google\Chrome\Application\chrome.exe
右键单击它,然后单击属性。说明是"Google Chrome".
请帮忙。
更新:
即使有人能给我一个方法来导出 Windows 任务管理器中显示的 "Description" 字段的数据,它也会帮助我。
检查 this - 它将 return the right-click-> details
一个文件。
你可以从 java 开始,像这样
try
{
String line=null;
String filePath="\"YOUR FILE PATH\"";
Process p = Runtime.getRuntime().exec("toolTipInfo.bat "+filePath);
String processDesc="";
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null)
{
if(line.contains("File description:"))
processDesc=line.split(":")[1].trim();
}
input.close();
}
catch(IOException e)
{
}