How to Add or Remove Per-directory Case Sensitivity Attribute Context Menu in Windows 10

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 10 build 17093, Microsoft introduced a new way to handle case sensitive files in Windows: per-directory case sensitivity. Microsoft uses this ability in the Windows Subsystem for Linux to give you better interoperability when using case sensitive files, and you can also use it yourself with regular Windows applications. As of Windows 10 build 17110, this behavior is the default.

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 (attribute) that can be applied to NTFS directories (folders). 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.

Starting with Windows 10 build 17107, Microsoft has added the ability to view and modify this flag to the fsutil.exe command.

Note that the per-directory case sensitivity flag is not inherited; directories created in a case sensitive directory are not automatically case sensitive themselves. You must explicitly mark each directory as case sensitive. Changing the flag requires “write attributes” permission to the directory.

This tutorial will show you how to add or remove a Case Sensitivity Attribute context menu for users to be able to query and set the case sensitivity attribute per-directory in Windows 10.

While you must be signed in as an administrator to add or remove this context menu, all users will be able to use the context menu when added.
If you get an "access is denied" message in the command output when using the context menu, then you will need to use the elevated Add Per-directory Case Sensitivity Context Menu in Windows 10-uac.jpg option in the context menu instead.

EXAMPLE: Case Sensitivity Attribute context menu for folders (directories)
Add Per-directory Case Sensitivity Context Menu in Windows 10-case_sensitive_attribute_context_menu.jpg
Add Per-directory Case Sensitivity Context Menu in Windows 10-case_sensitive_attribute_enabled.png Add Per-directory Case Sensitivity Context Menu in Windows 10-case_sensitive_attribute_disabled.png

Here's How:

1 Do step 2 (add) or step 3 (remove) below for what you would like to do.

2 To Add Case Sensitivity Attribute to Context Menu

A) Click/tap on the Download button below to download the file below, and go to step 4 below.



3 To Remove Case Sensitivity Attribute from Context Menu

This is the default setting.

A) Click/tap on the Download button below to download the file below, and go to step 4 below.



4 Save the .reg file to your desktop.

5 Double click/tap on the downloaded .reg file to merge it.

6 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

7 If you like, you can now delete the downloaded .reg file.

That's it,
Shawn Brink