Skip to main content
GameDev.net gamedev.net
🔒 Locked

C# find program directory

Started by smittix Jul 27, 2006 at 1:55 PM 2 replies 7.8k views
Original Post
smittix
smittix
Pretty simple I think, I just don't know how to do it and can't seem to find it on google. Is there a way in C# to find the directory of the program you are running?
frob
frob
There is a topic in MSDN titled: How to: Get the Application Directory

It includes this little snippit:

string strAppDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
SamLowry
SamLowry
There's also Application.ExecutablePath.

Application resides in System.Windows.Forms but it works for console applications as well (you'll need to add the appropriate reference though).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.