复制目录在 C:WindowsSystem32sppstore 中不起作用 [英] Copy Directory not work in C:WindowsSystem32sppstore

查看:19
本文介绍了复制目录在 C:WindowsSystem32sppstore 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的程序中复制此目录,当我尝试时它告诉我路径不存在".

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 文件夹,所以无法复制该目录的原因是它在 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:

  1. 改用 SysNative 文件夹.

您可以使用 C:WindowsSysNative 而不是 C:WindowsSystem32,它将 32 位应用程序带到 original System32 文件夹.

Instead of C:WindowsSystem32 you can use C:WindowsSysNative 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:WindowsSysNativesppstore", "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:WindowsSystem32sppstore", "your destination path here")
End If

  • 在 64 位模式或 AnyCPU 下编译您的应用.

    通过 P/调用 Wow64DisableWow64FsRedirection() 函数.(我真的不推荐这样做,因为如果您的应用尝试从系统目录加载 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:WindowsSystem32sppstore 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆