You’ve run afoul of file system redirection.
Because %windir%\System32
is reserved exclusively for 64-bit applications, on 64-bit versions of Windows, 32-bit applications that attempt to access the %windir%\System32
directory are automatically and transparent redirected to the 32-bit %windir%\SysWOW64
directory.
First, make sure that your program actually does belong in the 64-bit system folder. Windows does this automatic redirection for a reason. 32-bit stuff does not go in the %windir%\System32
folder on 64-bit versions of Windows.
If you’re certain that you want to be copying stuff into the 64-bit system directory, you have a couple of options. The easiest is probably to just compile your utility as a 64-bit application. Alternatively, you can tell the WOW64 redirector that you know what you’re doing and not to perform the redirection by using %windir%\Sysnative
instead of %windir%\System32
.