开发者

c# how to get the install path of my program?

guys.

In my program, i need to execute a kmlsample.exe in CMD, right now, it stays at my solution folder.

i can just do

string command = "\"C:\\Documents and Settings\\Bruce\\My Documents\\Visual Studio    2008\\Projects\\KMeans\\KMeans开发者_Python百科\\kmlsample.exe"  

but when i let the user to install my program, how can i know the path of my program got installed,

in order to execute the exe file.

thank you


This might be what your looking for.

http://msdn.microsoft.com/en-us/library/system.windows.forms.application.startuppath.aspx

Edit - You need to run this after the install inside your main program right? This won't work if you need to run something during the install.


You can get the executing assembly's location from

System.Reflection.Assembly.GetExecutingAssembly().Location
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜