Reputation: 31
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\\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
Upvotes: 2
Views: 5255
Reputation: 1840
You can get the executing assembly's location from
System.Reflection.Assembly.GetExecutingAssembly().Location
Upvotes: 2
Reputation: 17818
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.
Upvotes: 4