Enable Case Sensitive Mode for Folders in Windows 10

As you may already know, the Windows file system, NTFS, treats file and folder names as case insensitive. For example, for the OS and apps, MyFile.txt and myfile.txt are the same file. However, things are different in Linux. For this OS, these are two different files. This difference in behavior may create issues for WSL users. To resolve them, Windows 10 includes the ability to enable case sensitive mode for folders.

If you have used the Windows Subsystem for Linux, you’re probably aware that it allows you to treat your Windows file systems (mounted under /mnt/c, /mnt/d, etc.) as case sensitive. This means, among other things, that you can create files whose names differ only by case (e.g. foo.txt and FOO.TXT).

However, using those files in Windows was not really possible. Since Windows applications treat the file system as case insensitive, they cannot distinguish between files whose names only differ in case. While File Explorer would show both files, only one would be opened regardless of which one you clicked.

Starting with Windows insider build 17093, there is a new way to handle case sensitive files in Windows: per-directory case sensitivity. This ability has been added to give the user better interoperability when using case sensitive files. Also, you can use it with regular Windows applications. Starting in Windows 10 Build 17110, this behavior is the default.

More details

Case sensitivity in Windows

The Windows NT family of operating systems (including Windows 10) has always had the ability to perform case sensitive file system operations. Applications can pass the FILE_FLAG_POSIX_SEMANTICS flag to the CreateFile API to indicate that they want the path to be treated as case sensitive. However, for compatibility reasons, there is a global registry key that overrides this behavior; when this key is set, all file operations are case insensitive, even when the FILE_FLAG_POSIX_SEMANTICS flag is specified. Since Windows XP, this has been the default.

The Windows Subsystem for Linux uses another mechanism, which itself bypasses that registry key, allowing us to perform case sensitive file system operations. This is what allows Linux applications running in WSL to use file names that differ only by case, just like they can on real Linux, even with that global registry key set.

Unfortunately, this leaves you with files that can’t be accessed by Windows applications. While you could change the global registry key, that still would only work for those applications that use FILE_FLAG_POSIX_SEMANTICS, and this would change the behavior for all files on all drives, which may not be intended and may break some applications.

Per-directory case sensitivity

To solve this problem, Microsoft added a new case sensitive flag that can be applied to directories. For directories that have this flag set, all operations on files in that directory are case sensitive, regardless of whether FILE_FLAG_POSIX_SEMANTICS was specified. This means that if you have two files that differ only by case in a directory marked as case sensitive, all applications will be able to access them.

Enable Case Sensitive Mode for Folders

To enable or disable this feature, you should use the built-in fsutil.exe app.

To enable case sensitive mode for folders, do the following.

  1. Open an elevated command prompt.
  2. Type the following command:
    fsutil.exe file setCaseSensitiveInfo "full path to your folder" enable

    Substitute the path portion with the correct path matching your PC.
    For example,

    fsutil.exe file setCaseSensitiveInfo "C:\data\Winaero\Linux" enable

    Enable Case Sensitive Mode For Folders In Windows 10

  3. You are done.

Now, you can create two files with the same name and with only a case difference. Windows 10 will process them correctly in this particular folder.Case Sensitive Mode Windows 10

To see the feature status for a folder, run the command

fsutil.exe file queryCaseSensitiveInfo "full path to your folder"

For example,

fsutil.exe file queryCaseSensitiveInfo "C:\data\Winaero\Linux"

You'll see something like this:
Query Case Sensitive Mode Windows 10

Finally, to disable case sensitive mode for folders, run the next command in the command prompt opened as Administrator:

fsutil.exe file setCaseSensitiveInfo "C:\data\Winaero\Linux" disable

Use the correct folder path and you are done.
Note: Disabling the CaseSensitiveInfo attribute for non-empty folders is not supported. You must remove all files from the folder before disabling it.

That's it.

2 thoughts on “Enable Case Sensitive Mode for Folders in Windows 10

  1. Jimmy S.

    I would really like it if you could add this command to Winaero Tweaker as a tool like how you can merge multiple registry files.

    1. Sergey Tkachenko Post author

      I will do


Leave a Reply

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