Ich habe das mal etwas geändert:
[autoit]
#include <File.au3>
dim $drives, $file
[/autoit][autoit][/autoit][autoit]_FileReadToArray("Diskinfo6.txt",$drives)
[/autoit][autoit][/autoit][autoit]If IsArray($drives) Then ; Test, ob $drives = Array
$file = FileOpen("test.txt", 1)
If $file = -1 Then ; Check if file opened for writing OK
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
For $i = 1 to $drives[0] - 1 ; das -1 wenn die Leerzeile am Ende eingefügt wird
$free = DriveSpaceFree($drives[$i])
$total = DriveSpaceTotal($drives[$i])
$belegt = Round($total-$free)
FileWrite($file, $belegt & @CRLF)
Next
FileClose($file)
EndIf