auto run application that forced to run as administrator

89 Views Asked by At

i build a windows form setup application(.exe) and forced that run as administrator.

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

i want to auto run this app when windows was booted. To do this I added the following code to my program.

RegistryKey autoRun = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
autoRun.SetValue("my app name", Application.ExecutablePath.ToString());

now my problam is when i remove limit of run as administrator, my app auto run when windows was booted. but when my app forced to run as administrator, my app con't auto run. how can i solved this problam? thanks.

0

There are 0 best solutions below