I never needed to do this before and the examples i saw only show me how to put my current app from code in startup but not other .exe file in startup using code from current app
Asked
Active
Viewed 260 times
-1
-
1does this answer ypur question? https://stackoverflow.com/questions/5089601/how-to-run-a-c-sharp-application-at-windows-startup – Roman Kalinchuk Jun 21 '20 at 20:29
-
2There are multiple ways to have an application launched at startup on Windows; which do you intend to use? And do you mean "machine startup" or "user login"? What problem are you having adapting code to run the current application at startup to work with another application? – Lance U. Matthews Jun 21 '20 at 20:30
-
@BACON I mean at user login when windows start's up all it's programs I read about how to add current application but there is one parrameter that gets me confused rkApp.SetValue("MyApp", Application.ExecutablePath); i get MyApp should be the filename like "launcher.exe" but i don't get what to change Application.ExecutablePath with? should i put the executable path to "launcher.exe"? – Rares Andrei Jun 21 '20 at 20:41
-
It would appear that your code is the same as or shares lineage with that in the question @RomanKalinchuk linked. If you run your code and take a look at that registry key you should find that a `MyApp` value was created containing the path to that application. If the path to `launcher.exe` is known at compile time you would pass that instead, otherwise you'll need to construct it yourself. See [Run and RunOnce Registry Keys](https://learn.microsoft.com/windows/win32/setupapi/run-and-runonce-registry-keys). – Lance U. Matthews Jun 21 '20 at 21:02
1 Answers
-1
you can startup anything you want via using c# code using Process class like...
private void btnOpenApp_Click(object sender, EventArgs e)
{
System.Diagnostics.Procces.Start("appName.exe");
}

Mahmoud Mohamed Ramadan
- 389
- 6
- 12