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"?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top