tags:

views:

59

answers:

3

Hey guys, I'm coding a C# program to "Install" itself on the PC and run at starup to manage some scheduled tasks I have. I already have most of it done, including prompting the user, adding to startup, and such. But I want to copy the EXE when they run it after download, to C:\Program Files\Company\Program.exe

Is there any easy way to get the filepath+exe of a C# program from within the program? I've tried some System.Environment methods, and GetModuleInfo(), but I think I may just be overlooking something.

Is there a better way to go about this?

+1  A: 
System.Reflection.Assembly.GetExecutingAssembly().CodeBase
Anero
A: 

// Get and display the full name of the EXE assembly. string exeAssembly = Assembly.GetEntryAssembly().FullName; Console.WriteLine(exeAssembly);

AdamSane
+1  A: 
System.Reflection.Assembly.GetExecutingAssembly().Location
Timwi