复制目录在C:\Windows\System32\spp\存储中不起作用 [英] Copy Directory not work in C:\Windows\System32\spp\store
问题描述
我正在尝试从程序中复制此目录,当我尝试显示它时,它告诉我该路径不存在。
I am trying to make a copy of this directory from my program and when I try it tells me that, "the path does not exist".
推荐答案
如果您的应用程序是64位系统上的32位应用程序,则您遇到的是 文件系统重定向 。
If your application is a 32-bit app on a 64-bit system then you're experiencing what's called File system redirection.
由于32位应用程序无法加载64位dll,并且64位应用程序无法加载32位dll,因此64位系统具有两个系统文件夹:
Because 32-bit apps cannot load 64-bit dlls, and 64-bit apps cannot load 32-bit dlls, a 64-bit system has two system folders:
-
System32
-具有64位dll的64位版本,以及:
System32
- the 64-bit version with 64-bit dlls, and:
SysWOW64
-具有32位dll的32位版本。
SysWOW64
- the 32-bit version with 32-bit dlls.
文件系统重定向器自动将%SystemRoot%\System32
重定向到%SystemRoot%\SysWOW64
,用于尝试访问 System32
文件夹的所有32位应用程序,因此可以之所以不能复制目录,是因为该目录不存在于 SysWOW64
文件夹中。
The File System Redirector automatically redirects %SystemRoot%\System32
to %SystemRoot%\SysWOW64
for all 32-bit apps trying to access the System32
folder, so the reason you cannot copy the directory is because it doesn't exist in the SysWOW64
folder.
您可以通过三种方式克服这个。我以最推荐的顺序列出了它们,最不推荐的顺序是:
There are three ways you can overcome this. I've listed them in the order where the first is the most recommended, and the last is the least recommended:
-
使用代替
SysNative
文件夹。
代替 C:\Windows\System32
您可以使用 C:\Windows\SysNative
将32位应用程序带到原始 System32
文件夹。
Instead of C:\Windows\System32
you can use C:\Windows\SysNative
which will take 32-bit apps to the original System32
folder.
If Environment.Is64BitOperatingSystem = True AndAlso Environment.Is64Process = False Then 'Is this a 32-bit app in a 64-bit system?
My.Computer.FileSystem.CopyDirectory("C:\Windows\SysNative\spp\store", "your destination path here")
Else 'This is either a 64-bit app in a 64-bit system, or a 32-bit app in a 32-bit system.
My.Computer.FileSystem.CopyDirectory("C:\Windows\System32\spp\store", "your destination path here")
End If
以64位模式或 AnyCPU
编译应用。
通过P /调用 Wow64DisableWow64FsRedirection()
function 。 (我真的不建议这样做,因为如果您的应用尝试从系统目录中加载dll,事情可能会中断)。
Disable File System Redirection by P/Invoking the Wow64DisableWow64FsRedirection()
function. (I really do not recommend this as things might break if your app tries to load dlls from the system directory).
这篇关于复制目录在C:\Windows\System32\spp\存储中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!