C# 替换xml文件@C:\Windows\System32\WindowsPowerShell时出错

C# 替换xml文件@C:\Windows\System32\WindowsPowerShell时出错,c#,xml,c#-4.0,xpath,console-application,C#,Xml,C# 4.0,Xpath,Console Application,我正在编写一个控制台应用程序,试图用其他xml文件xx.config替换xml文件xx.config,该文件位于不同的文件夹中,路径为C:\Windows\System32\WindowsPowerShell,数据不同。 我有以下错误 找不到路径C:\Windows\System32\WindowsPowerShell\xx.config的一部分 但是在这个路径上有一个文件。我试图将此文件加载到XMLDocument,但也出现了相同的错误。谁能告诉我我做错了什么 XDocument xmldoc

我正在编写一个控制台应用程序,试图用其他xml文件xx.config替换xml文件xx.config,该文件位于不同的文件夹中,路径为C:\Windows\System32\WindowsPowerShell,数据不同。 我有以下错误

找不到路径C:\Windows\System32\WindowsPowerShell\xx.config的一部分

但是在这个路径上有一个文件。我试图将此文件加载到XMLDocument,但也出现了相同的错误。谁能告诉我我做错了什么

XDocument xmldoc=XDocument。Load@C:\test\xx.config\负载良好 XDocument xmldoc=XDocument。Load@C:\Windows\System32\WindowsPowerShell\xx.config\发生错误

文件。Move@C:\test\xx.config,>@C:\Windows\System32\WindowsPowerShell\xx.config\发生错误


尝试以管理员身份运行?我以管理员身份运行,但出现错误