Solution
This behavior happens because Windows automatically substitutes paths. In this case it occurs because
Windows 64-bit redirects
%WinDir%\system32 to a different folder, whenever a 32-bit application tries to access it. See this external link for more information:
File System Redirector - Microsoft DocsWindows stores files and drivers for its native bitness in the
%WinDir%\system32 directory. On Windows 64-bit, this directory is reserved for 64-bit applications. In case a 32-bit x86 application tries to access
%WinDir%\system32, it gets redirected to
%WinDir%\SysWOW64 instead.
If you want access to the 64-bit
%WinDir%\system32 using a 32-bit application on Windows 64-bit, use these directories
C:\Windows\Sysnative or
%WinDir%\Sysnative instead: