开发者

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

开发者 https://www.devze.com 2023-02-19 12:24 出处:网络
guys. In my program, i need to execute a kmlsample.exe in CMD, right now, it stays at my solution folder.

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

精彩评论

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