Jump to content

Recommended Posts

Guest pai
Posted

I want to get the pathname of the current directory in a c# program, but after searching in internet, i got none.

So, if anybody tell me how to get the current directory name?

Thanks

Guest pai
Posted
I want to get the pathname of the current directory in a c# program, but after searching in internet, i got none.

So, if anybody tell me how to get the current directory name?

Thanks

<{POST_SNAPBACK}>

by using

[C#]

public static string GetCurrentDirectory();

I got not support exception, wrong :cry:

Guest pai
Posted
.NET Compact Framework Platform Note:  The .NET Compact Framework does not support GetCurrentDirectory because current directory functionality is not used in devices running Windows CE .NET.
Guest pai
Posted

I have found the answer in a forum, the user has asked the same question and later he gave the answer by himself.

So, i write them here down, maybe it is for someone useful, maybe later.

string path = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;

path = Path.GetDirectoryName(path);

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.