Jump to content

How 2Get the path of the running application?


Recommended Posts

Guest sddavid
Posted

Can any one help me to get the full path of the running application?

I ve made a application and this application need to load some parameters

from a xml file. I wanna save the exe file and the xml file into a folder. However,

I dun know how 2 get the path. Can any one tell me how 2do this in C# ?

For example:

exe file: SmartBanner.exe

xml file: Setting.xml

these two files have been saved into

"\Storage Card\Program Files\Smart Banner"

Many thanks`!

Guest sddavid
Posted
Can any one help me to get the full path of the running application?

I ve made a application and this application need to load some parameters

from a xml file.  I wanna save the exe file and the xml file into a folder. However,

I dun know how 2 get the path. Can any one tell me how 2do this in C# ?

For example:

exe file: SmartBanner.exe

xml file: Setting.xml

these two files have been saved into

"\Storage Card\Program Files\Smart Banner"

Many thanks`!

<{POST_SNAPBACK}>

Yippee~! I have found the answer~!

To get the current directory in the smartphone, you should do like the following:

// We should use the namespace as following

using System.IO;

private void Form1_Load(object sender, EventArgs e)

{

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

strP = Path.GetDirectoryName(strP);

// show the result into the Label1;

this.label1.Text = strP;

}

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.