Link to home
Create AccountLog in
Avatar of theartha
thearthaFlag for United States of America

asked on

Directory Path

Hi There,

I created a Standalone app which goes on a cd along with other files in VB.net.

My question is: As the app reads the files on the cd, how can I get the file path?

Currently I am hardcoding as "C:\", but when it goes on CD hardcoded value may not be valid.

Dim directoryInfo As New IO.DirectoryInfo("C:\")
            Dim fileInfo As FileInfo() = directoryInfo.GetFiles()
            Dim files As FileInfo
.
.
.
.
.
.

Any advice?

Thanks.
Avatar of kaufmed
kaufmed
Flag of United States of America image

FileInfo has the DirectoryName and FullName properties, which will give the full name of the file's directory and the full path (including filename) of the file, respectively.
I'm not sure, but I think what you want is the current executable's directory: http://msdn.microsoft.com/en-us/library/aa457089.aspx
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
this will give you the full path of your exe location
ONLY if you haven't changed your application's current working directory during the course of execution  ; )