This is the part that crashes and gives me this error is when I try to copy a file to a certain location.
string startupDirectory = "C:\\Users\\Tyler\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup";
File.Copy(startupDirectory, "Startup.exe");
I have read online and tried administrator rights and have created an "app.manifest" file:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
I confirmed that in the settings, the app manifest is set to this file, but it still gives me the same error.
I have also tried this event though I didn't think it would work because it is a directory not a file:
File.SetAttributes(startupDirectory, FileAttributes.Normal);
This is WinForms and I am on windows 7 but also want it to world for windows 8+. How do I do this?
Thanks in advance!