Is it possible to open another copy of the application programmatically, in response to pressing a form button, as if simply opening an .exe file?

    1 answer 1

    Try this:

    Process.Start(Application.ExecutablePath); 

    This solution is specific to Windows Forms. A more general solution is to use reflection to find the path:

     Assembly.GetEntryAssembly().CodeBase 

    This call will return a URI string like

     file:///C:/Program Files/YourProgram/YourProgram.exe 

    which can be fed in Process.Start . If you still want the path with the usual syntax, apply the construction

     new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath 

    which will return an ordinary address like

     C:\Program Files\YourProgram\YourProgram.exe 
    • Comments are not intended for extended discussion; conversation moved to chat . - Nick Volynkin