How do you tell what directory an application is running from.

emaduddeen

Well-known member
Joined
May 5, 2010
Messages
171
Location
Lowell, MA & Occasionally Indonesia
Programming Experience
Beginner
Hi Everyone,

Can you tell me what code to use to let me know what directory my application is running from?

The reason for this question is related to installation of my application. I won't know where the user installs the application and I need to dynamically create my database connect string based on this information because I also install the database in the application directory the user chooses as well.

Thanks.

Truly,
Emad
 
Application.StartupPath returns the directory the executable is in.

As long as your program has write permission where the application is installed you'll be fine. You should know that the Program Files directory is not a directory to expect your app to have write permission in either.
 
Back
Top