Advertisement
Fhernd

UsoDriveInfo.cs

Jul 4th, 2015
930
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. namespace Receta.CSharp.R0501
  5. {
  6.     public class UsoDriveInfo
  7.     {
  8.         public static void Main()
  9.         {
  10.             Console.WriteLine ();
  11.            
  12.             // Obtención de las unidades actuales en el sistema:
  13.             DriveInfo[] unidades = DriveInfo.GetDrives();
  14.            
  15.             // Enlistamiento:
  16.             foreach (DriveInfo unidad in unidades)
  17.             {
  18.                 if (unidad.IsReady == true)
  19.                 {
  20.                     Console.WriteLine("Letra unidad:   {0}", unidad.Name);
  21.                     Console.WriteLine("Formato unidad: {0}", unidad.DriveFormat);
  22.                     Console.WriteLine("Nombre volumen: {0}", unidad.VolumeLabel);
  23.                     Console.WriteLine ();
  24.                 }
  25.             }
  26.            
  27.             Console.WriteLine();
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement