可以通过vbscript<br>以下是一个小脚本程序,存为(.vbs)即可<br>on error resume next<br>Dim fso, MyFile,wsh,dc,d,s<br>dim strs(2)<br>strs(0)="安装文件夹"<br>strs(1)="系统文件夹"<br>strs(2)="临时文件夹"<br>set wsh=WScript.CreateObject("WScript.shell")<br>Set fso = CreateObject("Scripting.FileSystemObject")<br>Set MyFile= fso.CreateTextFile("c:/testfile.txt", True)<br>Set dc = fso.Drives<br>myfile.writeline("////////////////////////////////////////////////////////////////////")<br>myfile.writeline(" ")<br>MyFile.WriteLine("-------所有分区-------")<br>For Each d in dc<br> s = s & d.DriveLetter & " - " <br> If d.DriveType = 3 Then<br> n = d.ShareName<br> ElseIf d.IsReady Then<br> n = d.VolumeName<br>end if<br>Select Case d.DriveType<br> Case 0: t = "---未知"<br> Case 1: t = "---可移动"<br> Case 2: t = "---固定磁盘"<br> Case 3: t = "---网络"<br> Case 4: t = "---CD-ROM"<br> Case 5: t = "---RAM 磁盘"<br> End Select<br>if (d.AvailableSpace/1024/1024/1024)>1 then<br>freesize=" 可用空间: " & FormatNumber(d.AvailableSpace/1024/1024/1024, 2) & "<GB>"<br>elseif (d.AvailableSpace/1024/1024)>1 then<br>freesize=" 可用空间: " & FormatNumber(d.AvailableSpace/1024/1024, 2) & "<MB>" <br>elseif (d.AvailableSpace/1024)>1 then<br>freesize=" 可用空间: " & FormatNumber(d.AvailableSpace/1024, 2) & "<KB>"<br>elseif (d.AvailableSpace)>1 then<br>freesize=" 可用空间: " & FormatNumber(d.AvailableSpace, 0) & "<Bytes>"<br>end if<br>if (d.totalsize/1024/1024/1024)>1 then<br>totalsize=" 分区大小: " & FormatNumber(d.totalsize/1024/1024/1024, 2) & "<GB>"<br>elseif (d.totalsize/1024/1024)>1 then<br>totalsize=" 分区大小: " & FormatNumber(d.totalsize/1024/1024, 2) & "<MB>" <br>elseif (d.totalsize/1024)>1 then<br>totalsize=" 分区大小: " & FormatNumber(d.totalsize/1024, 2) & "<KB>"<br>elseif (d.totalsize)>1 then<br>totalsize=" 分区大小: " & FormatNumber(d.totalsize, 0) & "<Bytes>"<br>end if<br><br> s = s & n & t & "(" & totalsize & freesize & ")"<br>MyFile.WriteLine(s)<br>s=""<br> Next<br>for i=0 to 2<br>MyFile.WriteLine(strs(i)+":"+fso.GetSpecialFolder(i))<br>next<br>MyFile.Close<br>if (fso.FileExists("c:/testfile.txt")) then<br>wsh.popup "按确定察看分区信息"<br>wsh.run "c:/testfile.txt"<br>else<br>wsh.popup "文件建立失败"<br>end if