0
Я установить значение ключа в реестре следующим образом-Получить аргумент из реестра C#
RegistryKey registryKey = Registry.CurrentUser.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
registryKey.SetValue("MobiCheckerTest", Application.ExecutablePath + "%autostart");
реестра выглядит как-
C:\Users\skpaul\Desktop\StartupApp\StartupApp\bin\Debug\StartupApp.EXE%autostart
В Program.cs
static void Main(string[] args) //args= string[0].
{
Program.LaunchedViaStartup = args != null && args.Any(arg => arg.Equals("autostart", StringComparison.CurrentCultureIgnoreCase));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Form1. cs
public Form1()
{
InitializeComponent();
MessageBox.Show(this, string.Format("Lanched Via Startup Arg:{0}", Program.LaunchedViaStartup));
}
Аргумент не может быть прочитан в program.cs.
Любая помощь?