如何在 Windows 上获取文件的详细信息 [英] How to get the details of a file on Windows

查看:68
本文介绍了如何在 Windows 上获取文件的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在 Windows 中打开文件的属性,通常会有一个详细信息选项卡.我想访问此选项卡上的信息,但我不知道如何访问.有它的模块吗?有人有代码片段吗?

If you open the properties of a file in Windows, there usually is a Details tab. I want to access the information on this tab, but I don't know how. Is there a module for it? Does someone has a code sniplet?

我尝试使用 Win32::File 的 GetAttributes,但这些不是我想要的属性.

I tried to work with Win32::File's GetAttributes, but these are not the attributes I was looking for.

推荐答案

use Win32::OLE;

my $objShell  = Win32::OLE->new("Shell.Application") or die;
my $objFolder = $objShell->NameSpace($myDir) or die;
my $objFile   = $objFolder->ParseName($fileName) or die;

while ( $i <= 34 ) 
{
  my $propertyName  = $objFolder->GetDetailsOf($fileName,$i);
  my $propertyValue = $objFolder->GetDetailsOf($objFile,$i);
  print "$i -- $propertyName -- $propertyValue\n";
  $i++;
} 

这篇关于如何在 Windows 上获取文件的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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