Console and Cygwin Don’t Show All Files on 64-bit Windows

Running Cygwin bash or Console under 64-bit versions of Windows, directory listings sometimes differ from results shown in Explorer or cmd.exe. For example, Defrag.exe is visible to the default command shell (CMD):

C:\Windows\System32>dir Defr*

07/13/2009  05:39 PM           183,296 Defrag.exe
07/13/2009  05:40 PM            16,384 defragproxy.dll
07/13/2009  05:40 PM           291,328 defragsvc.dll

The same listing under Cygwin bash yields no results:

$ cd /cygdrive/c/Windows/System32

$ ls Defra*
ls: cannot access Defra*: No such file or directory

In fact, on this system, Cygwin reports sees only 2,465 files in System32, while CMD sees 2,857 files.

This is because Cygwin bash and Console are 32-bit applications, and I’m running 64-bit Windows. With filesystem virtualization on Windows, when a 32-bit process attempts to access %SYSTEMROOT%\System32, it is redirected to %SYSTEMROOT%\SYSWOW64. Ironically named, System32 contains 64-bit applications, while SYSWOW64 contains 32-bit applications.

About Jeff Fitzsimons

Jeff Fitzsimons is a software engineer in the California Bay Area. Technical specialties include C++, Win32, and multithreading. Personal interests include rock climbing, cycling, motorcycles, and photography.
This entry was posted in Technology, Windows. Bookmark the permalink.

One Response to Console and Cygwin Don’t Show All Files on 64-bit Windows

  1. Pancho says:

    I actually have the opposite problem, cygwin shows some files (java.exe) available in a directory (/cygdrive/c/windows/system32); but if you look at the same directory using a windows cmd shell or file explorer, the file is not there. I just discovered this and I’m still researching the issue.

Leave a Reply

Your email address will not be published. Required fields are marked *