using namespace System::IO;

	try
	{
		array<DriveInfo^> ^allDrives = DriveInfo::GetDrives();

		for each (DriveInfo ^drive in allDrives)
		{
			sTemp += "Drive Name: " + drive->Name;
			sTemp += ", Type " + Convert::ToString(drive->DriveType);
			if ((drive->DriveType == DriveType::Fixed) && (drive->IsReady))
			{
				sTemp += ", Volume Label: " + drive->VolumeLabel;
				sTemp += ", File System: " + drive->DriveFormat;

				if (drive->TotalSize >= 1073741824)
					sTemp += ", Total size: " + Convert::ToInt64(drive->TotalSize / 1073741824) + " GB";
				else if (drive->TotalSize >= 1048576)
					sTemp += ", Total size: " + Convert::ToInt64(drive->TotalSize / 1048576) + " MB";
				else
					sTemp += ", Total size: " + drive->TotalSize / 1048576 + " bytes";

				if (drive->TotalFreeSpace >= 1073741824)
					sTemp += ", Total available space: " + Convert::ToInt64(drive->TotalFreeSpace / 1073741824) + " GB";
				else if (drive->TotalFreeSpace >= 1048576)
					sTemp += ", Total available space: " + Convert::ToInt64(drive->TotalFreeSpace / 1048576) + " MB";
				else
					sTemp += ", Total available space: " + drive->TotalFreeSpace + " bytes";

				if (drive->AvailableFreeSpace >= 1073741824)
					sTemp += ", Available space to current user: " + Convert::ToInt64(drive->AvailableFreeSpace / 1073741824) + " GB";
				else if (drive->AvailableFreeSpace >= 1048576)
					sTemp += ", Available space to current user: " + Convert::ToInt64(drive->AvailableFreeSpace / 1048576) + " MB";
				else
					sTemp += ", Available space to current user: " + drive->AvailableFreeSpace + " bytes";
			}
			sTemp += "\r\n";
		}
	}
	catch (Exception ^)
	{
	}
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.