System.IO.DriveInfo[] disk = System.IO.DriveInfo.GetDrives(); foreach (System.IO.DriveInfo di in disk) { this.listBox1.Items.Add(di.Name); }
得到的结果c:\
d:\
f:\
g:\