Path of the local directory

Posted by Jayesh on Stack Overflow See other posts from Stack Overflow or by Jayesh
Published on 2010-05-26T08:21:27Z Indexed on 2010/05/26 8:31 UTC
Read the original article Hit count: 117

Filed under:

Hi,

A rather simple question; how to find the path of the local directory in which my exe is placed? As-in I have an .exe and in the program I have to create a txt file in the directory where the exe is!

[language - C#]

So, if the exe is in C:/Temp and is started from there; my txt should be created in C:/Temp

If the user wishes to move the exe to D:/Temp and runs from there; I should be able to create the txt file in D:/Temp

I tried the Directory.GetCurrentDirectory() but that returns the directory of the execution of the program!

© Stack Overflow or respective owner

Related posts about c#