質問

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