Results 1 to 4 of 4

Thread: [RESOLVED] [2.0] Get current harddisk drive letter?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    Resolved [RESOLVED] [2.0] Get current harddisk drive letter?

    How do you get the current harddisk drive? Like mine is C: but some people use D:, F:, etc.

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [2.0] Get current harddisk drive letter?

    Are you looking for SystemRoot.

    C# Code:
    1. //Returns path of System32 folder in Windows folder
    2. //%SYSTEMROOT%\Windows\System32
    3. string str = System.Environment.SystemDirectory;
    4.  
    5. //Pass this path to get the drive name
    6. System.IO.DriveInfo di = new System.IO.DriveInfo(str);
    7. Console.WriteLine(di.Name);
    Show Appreciation. Rate Posts.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    Re: [2.0] Get current harddisk drive letter?

    Quote Originally Posted by Harsh Gupta
    Are you looking for SystemRoot.

    C# Code:
    1. //Returns path of System32 folder in Windows folder
    2. //%SYSTEMROOT%\Windows\System32
    3. string str = System.Environment.SystemDirectory;
    4.  
    5. //Pass this path to get the drive name
    6. System.IO.DriveInfo di = new System.IO.DriveInfo(str);
    7. Console.WriteLine(di.Name);
    thankyou, rated.

  4. #4
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [RESOLVED] [2.0] Get current harddisk drive letter?

    Glad to help you!!!
    Show Appreciation. Rate Posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width