I do this in my C# program:
File.copy(Application.StartupPath + "\Test.txt",@"c:\Test.txt");
But I get this error:
Access to the path 'c\Test.txt' is denied
It happens only in Windows 7, in Windows XP it works excellent.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Access is denied. That means you don’t have access. No, really, it does.
User accounts in Windows 7 are limited (non-Administrator) by default, so your program cannot just write anywhere on the system (and that is a Good Thing (TM)). Try putting
Test.txtin another directory, for example the temp directory (ask the system where that is).