Determine what current drive letter is?

  • Thread starter Thread starter johnb41
  • Start date Start date
J

johnb41

I need to find out what the current drive letter that is being used for
the application. Because i want to copy/move files to a fixed path,
and don't want to hard code in "C:\" when it's not certain that the
drive exists.

Thanks for the help!
John
 
johnb41 said:
I need to find out what the current drive letter that is being used for
the application. Because i want to copy/move files to a fixed path,
and don't want to hard code in "C:\" when it's not certain that the
drive exists.

Thanks for the help!
John

By "being used by the application" do you mean the same drive the EXE
was loaded from? If so, it can be gleaned from the
Application.StartupPath property.
 
johnb41 said:
I need to find out what the current drive letter that is being used for
the application. Because i want to copy/move files to a fixed path,
and don't want to hard code in "C:\" when it's not certain that the
drive exists.

\\\
Imports System.IO
....
MsgBox(Path.GetPathRoot(My.Application.Info.DirectoryPath))
///
 
Wow, thanks guys for the quick answers. Both answers seem to do the
trick.

It's frustrating that "my.application.bla bla" has different
properties/methods than simply "application.bla bla". Some things are
the same, but with different names, and other things exist in one, but
not the other. :(

Thanks again!
John
 
Back
Top