Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. drive name [modified]

drive name [modified]

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    allenmpcx
    wrote on last edited by
    #1

    Is there a way to get a the name of the logical drive? Not the drive letter, but the name. For example, the drive C: usually appears in under My Computer as "Local Disk ( C: )". How would I obtain the "Local Disk" text? I love to program!

    J D A 3 Replies Last reply
    0
    • A allenmpcx

      Is there a way to get a the name of the logical drive? Not the drive letter, but the name. For example, the drive C: usually appears in under My Computer as "Local Disk ( C: )". How would I obtain the "Local Disk" text? I love to program!

      J Offline
      J Offline
      Jun Du
      wrote on last edited by
      #2

      Give a try to WMI. There are some CP articles about WMI in C#: start here. Best, Jun

      1 Reply Last reply
      0
      • A allenmpcx

        Is there a way to get a the name of the logical drive? Not the drive letter, but the name. For example, the drive C: usually appears in under My Computer as "Local Disk ( C: )". How would I obtain the "Local Disk" text? I love to program!

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        If your using C# 2005, you can get this from the DriveInfo[^] class. "Local Disk" is the drive Type, and is used only because the drive doesn't have a volume label. Dave Kreskowiak Microsoft MVP - Visual Basic -- modified at 14:06 Wednesday 12th July, 2006

        1 Reply Last reply
        0
        • A allenmpcx

          Is there a way to get a the name of the logical drive? Not the drive letter, but the name. For example, the drive C: usually appears in under My Computer as "Local Disk ( C: )". How would I obtain the "Local Disk" text? I love to program!

          A Offline
          A Offline
          allenmpcx
          wrote on last edited by
          #4

          All very good answers, however the codeproject reference gets the drive letter, as does the DriveInfo class for C# 2005. Lets say you plug in an external hard-drive and assign it the drive letter (which is the Name property of the DriveInfo class and the ManagementObject["name"] property for WMI) "V:", and you also name it "External hard-drive". How would I get the "External hard-drive" text? I love to program!

          D 1 Reply Last reply
          0
          • A allenmpcx

            All very good answers, however the codeproject reference gets the drive letter, as does the DriveInfo class for C# 2005. Lets say you plug in an external hard-drive and assign it the drive letter (which is the Name property of the DriveInfo class and the ManagementObject["name"] property for WMI) "V:", and you also name it "External hard-drive". How would I get the "External hard-drive" text? I love to program!

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            That's the VolumeLabel property of the DriveInfo class. Dave Kreskowiak Microsoft MVP - Visual Basic

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups