0

Why does File.Exists(@"C:\Windows\System32\SnippingTool.exe") always return false? I can see the file in the Windows Explorer, it is not a shortcut, the command dir finds SnippingTool.exe, Windows' run dialog executes C:\Windows\System32\SnippingTool.exe just normally and every user has at least reading and executing privileges on this file, so I can't find a reason, why this file is invisible to my application. Even, if I start my application with administrative privileges it can't find SnippingTool.exe. I came across this strange behavior, because Process.Start always threw a Win32Exception on this file.

Can anyone else reproduce this problem? If so, can someone explain to me, why this file is invisible to my application?

(Just in case: I'm working with Windows 8.1 x64 with .NET v4.0.30319)

Cubi73
  • 1,891
  • 3
  • 31
  • 52
  • 1
    Are you compiling against a "32-bit" or "AnyCPU" runtime? If so, you're probably being tricked by 32-bit filesystem redirection, and `File.Exists(@"C:\Windows\System32\SnippingTool.exe")` internally get's redirected to `File.Exists(@"C:\Windows\SysWOW64\SnippingTool.exe")` – Mathias R. Jessen Sep 20 '15 at 13:21
  • I'm compiling against AnyCPU. Compiling against x64 worked. – Cubi73 Sep 20 '15 at 13:24

0 Answers0