简体   繁体   English

Directory.EnumerateFiles异常

[英]Directory.EnumerateFiles exception

I have a very rare behaviour. 我有一种非常罕见的行为。

I'm using Windows 10 x64 and Visual Studio 2013 and when I run this code in an 32 bits application 我正在使用Windows 10 x64和Visual Studio 2013,当我在32位应用程序中运行此代码时

Directory.EnumerateFiles(@"C:\Windows\System32\winevt").Count() 

I have an exception of type System.IO.DirectoryNotFoundException 我有类型System.IO.DirectoryNotFoundException的例外

If I open a non admin cmd console and I run 如果我打开一个非管理员cmd控制台,我运行

dir C:\Windows\System32\winevt

the result is the list of folders in winevt folder. 结果是winevt文件夹中的文件夹列表。 The folder exists and has sub folders. 该文件夹存在并具有子文件夹。

Any idea? 任何的想法?

Thank you 谢谢

In x64 version - all access to System32 redirected to C:\\Windows\\SystemWOW64. 在x64版本中 - 对System32的所有访问都重定向到C:\\ Windows \\ SystemWOW64。

Try to use this variant to access it: 尝试使用此变体来访问它:

 Directory.EnumerateFiles(@"C:\Windows\Sysnative\winevt").Count() 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM