Answer the question
In order to leave comments, you need to log in
How to add a program to startup?
There is a program (prog1) that adds another program (prog2) to startup as follows:
string ExePath = Environment.CurrentDirectory + "\\prog2.exe"; //получает текущий путь до приложения
RegistryKey reg; //ключ реестра
reg = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run\\");
reg.SetValue("prog2.exe", ExePath); //добавляется в автозагрузку
reg.Close();
Answer the question
In order to leave comments, you need to log in
В аргументах File.Exists использовать Application.StartupPath
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question