Hossein Ameri
Hossein Ameri

Reputation: 11

auto run application that forced to run as administrator

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.

Upvotes: 0

Views: 149

Answers (0)

Related Questions