如何在Windows机器中使用perl查找磁盘空间?

如何在Windows机器中使用perl查找磁盘空间?,perl,Perl,我需要使用perl获得windows机器中的可用磁盘空间,即总磁盘空间 比如, use strict; my $curr_drive="c:\"; 从上面的代码中,我想得到c:\驱动器的可用空间和总空间。 我试过使用Filesys::DiskSpace模块。但是我不知道如何继续windows的模块。 请分享你的解决方案 谢谢该模块在Windows上不受支持。你必须使用 请尝试以下操作: use strict; use warnings; use Win32::DriveInfo; my (

我需要使用perl获得windows机器中的可用磁盘空间,即总磁盘空间

比如,

use strict;
my $curr_drive="c:\";
从上面的代码中,我想得到c:\驱动器的可用空间和总空间。 我试过使用Filesys::DiskSpace模块。但是我不知道如何继续windows的模块。 请分享你的解决方案

谢谢

该模块在Windows上不受支持。你必须使用

请尝试以下操作:

use strict;
use warnings;

use Win32::DriveInfo;

my (undef, undef, undef, undef, undef, $total, $free) =
    Win32::DriveInfo::DriveSpace('c');

我相信CPAN有你的答案:

如中所述,
Filesys::DfPortable模块应作为可移植解决方案(支持Windows)首选。