Advertisement

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.

Advertisеment

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.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Advertisеment

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

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

  1. 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.

Leave a Reply

Your email address will not be published.

css.php
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.