2017-06-11 1 views
0

私のコードでC:\ Windows \ System32 \ winevtディレクトリにアクセスしようとしていますが、System.IO.DirectoryNotFoundExceptionがあります。C#でwinevtディレクトリにアクセスするとDirectoryNotFoundExceptionがスローされる

私はこのスレッドを読んで: Anyone know why I can't access the winevt folder programmatically in C#?

これはSystemWOW64ディレクトリに64ビットオペレーティングシステムで32ビットアプリケーションを実行すると、再度指示することを私に意味し、解像度が代わりに設定することです私のディレクトリ%windir%\Sysnative\winevtに。だから私は上記のスレッドで提供されている答えに合致するようにコードを修正しましたが、まだ失敗します。私は実行中ですwindows 10 enterprise 64-bitとSysnativeは存在しません。

コード例:

  string directory = @"C:\Windows\System32";     
      bool isDirectoryExists = Directory.Exists(directory); 

これはfalseを返します:

これはtrueを返します

  string directory = @"C:\Windows\System32\winevt";     
      bool isDirectoryExists = Directory.Exists(directory); 

は、ディレクトリシステムとSYSWOW64にはwinevtディレクトリはありません、とシスネラティブは存在しません。だから私の質問は、どのように私はwinevtディレクトリにアクセスできますか?

答えて

0

私の間違いは、Windowsディレクトリ内のSysnativeという実際のフォルダを探していたのですが、私はそれを見ていなかったので、コードはうまくいかないと思います。しかし、私はとにかくそれをテストし、Directory.Existsがtrueを返しました。これは、Sysnativeが仮想フォルダであるためです。真

戻り値:

 string directory = @"C:\Windows\Sysnative\winevt";     
     bool isDirectoryExists = Directory.Exists(directory); 

http://www.thewindowsclub.com/sysnative-folder-in-windows-64-bit

関連する問題