代码之家  ›  专栏  ›  技术社区  ›  Yongwei Xing

使用Perl获取硬盘信息

  •  5
  • Yongwei Xing  · 技术社区  · 14 年前

    我想用Perl检查 窗户 有什么办法吗?

    最好的问候,

    4 回复  |  直到 13 年前
        1
  •  6
  •   cjm    14 年前

    看见 Win32::DriveInfo

    ($SectorsPerCluster, $BytesPerSector, $NumberOfFreeClusters, 
    $TotalNumberOfClusters, $FreeBytesAvailableToCaller, $TotalNumberOfBytes, $TotalNumberOfFreeBytes) =  Win32::DriveInfo::DriveSpace( drive );
    
       $SectorsPerCluster          - number of sectors per cluster.
       $BytesPerSector             - number of bytes per sector.
       $NumberOfFreeClusters       - total number of free clusters on the disk.
       $TotalNumberOfClusters      - total number of clusters on the disk.
       $FreeBytesAvailableToCaller - total number of free bytes on the disk that
                                     are available to the user associated with the
                                     calling thread, b.
       $TotalNumberOfBytes         - total number of bytes on the disk, b.
       $TotalNumberOfFreeBytes     - total number of free bytes on the disk, b.
    
        2
  •  8
  •   daxim e.dan    14 年前

    大多数时候,便携式解决方案 Filesys::DfPortable 是更好的选择。认识到机会 virtuously lazy .

        3
  •  1
  •   weismat    14 年前

    Win32 Drive Info 应该有技巧。
    我猜你在找

    $totalNumberOfFreeBytes

        4
  •  0
  •   dolmen    14 年前

    另一种查询系统状态的方法是查询 Windows Management Interface 使用 DBD::WMI .

    下面的查询将提供有关磁盘空间的基本信息:

    Select DeviceID,Size,FreeSpace from Win32_LogicalDisk