Error: An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

后端 未结 4 896
粉色の甜心
粉色の甜心 2021-01-02 23:34

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\\\         


        
4条回答
  •  臣服心动
    2021-01-02 23:37

    Try this:

        File.Copy(startupDirectory, "Startup.exe", true);
        File.SetAttributes("Startup.exe", FileAttributes.Normal);
    

提交回复
热议问题