Question

I'm trying copy file to startup folder. Here is my code:

            String ^path;
            path = Environment::GetFolderPath(Environment::SpecialFolder::CommonStartup);
            path += "\\EFM.lnk";

            if(!IO::File::Exists(path))
                IO::File::Copy("C:\\lng\\EFM.lnk",path);

It's simple but don't working. I would like to ask you: "why"?

Was it helpful?

Solution

If the process lacks administrative rights and its manifest doesn't mark it as aware of UAC isolation, writes to the Common Startup folder (which requires administator access) may be silently redirected to C:\Users\{your name}\AppData\Local\VirtualStore.

This explains both the lack of file in the real folder and the lack of UnauthorizedAccessException or any other error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top