.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

C# Directory question

Hello, is there a way to know the directory where the program is at?

For example, with my program I must distribute an external folder with documents.

And in the program I need to know where the program is, so I can know where the folder is.

For example:




So how do I know from C# where the program.exe is at, so the application is more flexible in terms of directories.

Monday, November 12, 2007

But keep in mind that you typically can't create files under that directory if it is under "c:\Program Files" unless you have admin privileges. So what I do is have all of my support files like bitmaps and such under the program directory. And then configuraton, settings, and log files get created under the appropriate user directory using:


The path above is common to all users of the machine. If I want to have a user-specific folder I would use:

Wednesday, November 14, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz