Sometimes I need to delete or replace a dll file in system32 folder of windows 7.
The code below always has Permission Denied Error
:
if (File.Exists(@"C:\Windows\system32\mydll.dll"))
{
fileInfo.IsReadOnly = false;
File.Delete(@"C:\Windows\system32\mydll.dll");
}
How can I bypass this error and replace a file in system32 folder?