#################################################################### # # This function returns a list of logical drives in Windows. # Each list element starts with drive letter, followed by # drive type, serial number, file system, label, total space # and free space. All items will be separated by a '*' character. # # If one or more letters are provided as an argument, # then data will be returned only about those drives. # Example: # GetDriveInfo('CE') => Returns data about drive C: and E: # If drive E: does not exist, then it will be left # out of the list! # # Usage: STRING = GetDriveInfo([DRIVEs]) # sub GetDriveInfo { my $DRIVES = defined $_[0] ? $_[0] : 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; return RunJS("V='$DRIVES';try{FSO=new ActiveXObject('Scripting.FileSystemObject');}catch(e){WScript.Quit(0);}A=[];function ToHex(N){N|=0;var i,X='';for(i=0;i<32;i+=4)X='0123456789ABCDEF'.charAt((N>>i)&15)+X;return X;}for(i=0;i$TEMPFILE") or return 0; binmode FILE; print FILE $_[0]; close FILE; -f $TEMPFILE && -s $TEMPFILE == length($_[0]) or return 0; my $E = system("$CSCRIPT //NOLOGO $TEMPFILE"); unlink $TEMPFILE; return $E + 1; }