使用Perl获取硬盘信息

我想使用perl来检查Windows上的硬盘空间,有没有办法做到这一点?

最好的祝福,

Solutions Collecting From Web of "使用Perl获取硬盘信息"

请参阅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. 

大多数情况下,诸如Filesys::DfPortable类的便携式解决方案是更好的选择。 认识到这个机会是非常懒惰的 。

Win32驱动器信息应该做的伎俩。
我想你正在寻找

$ TotalNumberOfFreeBytes

查询系统状态的另一种方法是使用DBD :: WMI查询Windows管理界面 。

以下查询应该给你关于磁盘空间的基本信息:

 Select DeviceID,Size,FreeSpace from Win32_LogicalDisk