C# File.Exists returns false, file does exist

If you are using x64 system, you will have different content of the c:\Windows\System32 directory for x86 and x64 applications. Please be sure that you are using same architecture running batch file and your C# app.


In the MSDN documentation for System.IO.File.Exists(path), it states:

If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns false regardless of the existence of path.

For this reason, we can safely assume that your application does not have read access to that specific file. Check the security settings and grant read access if not already done so.

Build your application (in release mode) and run as administrator.