![启用tim无法访问文件夹](https://i-blog.csdnimg.cn/blog_migrate/95a9d85d587eab44464fc0ea924c1e1f.png)
启用tim无法访问文件夹
![](https://i-blog.csdnimg.cn/blog_migrate/351ed8c896df85d4200836180c5cc11f.png)
Windows 10 now offers an optional case-sensitive file system, just like Linux and other UNIX-like operating systems. All Windows processes will handle case-sensitive files and folders properly if you enable this feature. In other words, they’ll see “file” and “File” as two separate files.
Windows 10现在提供了一个可选的区分大小写的文件系统,就像Linux和其他类似UNIX的操作系统一样。 如果启用此功能,则所有Windows进程都会正确处理区分大小写的文件和文件夹。 换句话说,他们会将“文件”和“文件”视为两个单独的文件。
运作方式 (How This Works)
This is an NTFS file system feature that you can enable on a per-directory basis. It doesn’t apply to your entire file system, so you can just enable case sensitivity for specific folders you use for development purposes.
这是一个NTFS文件系统功能,可以按目录启用。 它不适用于整个文件系统,因此您可以为用于开发目的的特定文件夹启用区分大小写功能。
Case sensitivity was added in Windows 10’s April 2018 Update. Prior to this, it was possible to mount Windows folders as case sensitive within the Bash on Windows environment, also known as the Windows Subsystem for Linux. That worked fine within the Linux environment, but it confused normal Windows applications. This is now a file-system level feature, which means all Windows applications will see a case sensitive file system in that folder, too.
Windows 10的2018年4月更新中增加了区分大小写的功能 。 在此之前,可以在Windows环境中的Bash (也称为Linux的Windows子系统)中以区分大小写的方式安装Windows文件夹。 在Linux环境中可以正常工作,但会混淆普通的Windows应用程序。 现在,这是文件系统级别的功能,这意味着所有Windows应用程序也将在该文件夹中看到区分大小写的文件系统。
This feature is enabled via the fsutil.exe
command, which you must run from the command line. You can do it from either a Command Prompt or PowerShell window. With the default settings, folders you create within the Linux environment are automatically configured to be case sensitive, as well.
通过fsutil.exe
命令启用此功能,您必须从命令行运行该命令。 您可以从命令提示符或PowerShell窗口中进行操作。 使用默认设置,您在Linux环境中创建的文件夹也将自动配置为区分大小写。
如何将目录设置为区分大小写 (How to Set a Directory as Case Sensitive)
To get started, right-click the Start button, and then select the “PowerShell (Administrator)” command. If you prefer using the Command Prompt, you can search for “Command Prompt” in your Start menu, right-click it, and then select the “Run as Administrator” command. The command works the same, no matter which command-line environment you choose.
要开始使用,请右键单击“开始”按钮,然后选择“ PowerShell(Administrator)”命令。 如果您更喜欢使用命令提示符,则可以在“开始”菜单中搜索“命令提示符”,右键单击它,然后选择“以管理员身份运行”命令。 无论您选择哪种命令行环境,该命令的作用都相同。
You may not actually need Administrator access to run this command, depending on your permissions. Technically, you need the “write attributes” permission for the directory you want to modify. In most cases, this means that you’ll need Administrator permissions if you want to edit a folder somewhere outside your user folder—such as c:\project—-and not if you want to modify a folder somewhere inside your user folder—such as at c:\users\NAME\project.
根据您的权限,您实际上可能不需要管理员权限来运行此命令。 从技术上讲,您需要对要修改的目录具有“写入属性”权限。 在大多数情况下,这意味着如果您要编辑用户文件夹之外的某个文件夹(例如c:\ project),则需要管理员权限,而不是如果要修改用户文件夹内部的某个文件夹,则不需要管理员权限。如c:\ users \ NAME \ project。
![](https://i-blog.csdnimg.cn/blog_migrate/79f5e6aa08befd25a84760b672c6dcc9.png)
Before continuing, be sure that no running Linux software is currently referencing the directory you’re about to modify. You should not change the case sensitivity flag on a folder while Linux software is accessing it. If any running Linux processes currently have the directory or anything inside the directory open, even as their current working directory, Linux applications won’t recognize the change and problems may occur.
在继续之前,请确保当前没有正在运行的Linux软件正在引用您要修改的目录。 在Linux软件访问文件夹时,请勿更改文件夹的区分大小写标志。 如果任何正在运行的Linux进程当前都打开了目录或目录中的任何内容,即使它们处于当前工作目录,Linux应用程序也将无法识别更改,并且可能会出现问题。
To make a folder case sensitive, type the following command, replacing “C:\folder” with the path to the folder:
要使文件夹区分大小写,请键入以下命令,将“ C:\ folder”替换为文件夹的路径:
fsutil.exe file setCaseSensitiveInfo C:\folder enable
If the folder path has a space in it, enclose the whole path in quotation marks, like so:
如果文件夹路径中有空格,则将整个路径用引号引起来,如下所示:
fsutil.exe file setCaseSensitiveInfo "C:\my folder" enable
![](https://i-blog.csdnimg.cn/blog_migrate/76197f3411e23983c3afcd281adff023.png)
这不会影响子文件夹 (This Doesn’t Affect Subfolders)
The case sensitivity flag only affects the specific folder to which you apply it. It isn’t automatically inherited by that folder’s subfolders.
区分大小写标志仅会影响您将其应用到的特定文件夹。 该文件夹的子文件夹不会自动继承它。
In other words, if you have a folder named C:\folder and it has C:\folder\test and C:\folder\stuff subfolders inside it, simply making the C:\folder folder case sensitive wouldn’t also make the “test” and “stuff” subfolders inside it case sensitive. You’d need to run the appropriate fsutil
command separately to make all three folders case sensitive.
换句话说,如果您有一个名为C:\ folder的文件夹,并且其中包含C:\ folder \ test和C:\ folder \ stuff子文件夹,那么仅使C:\ folder文件夹区分大小写也不会使其中的“ test”和“ stuff”子文件夹区分大小写。 您需要单独运行适当的fsutil
命令,以使所有三个文件夹区分大小写。
![](https://i-blog.csdnimg.cn/blog_migrate/50d1446ddffc3310d896b69532866e50.png)
Linux工具默认创建区分大小写的文件夹 (Linux Tools Create Case Sensitive Folders by Default)
Linux tools you run inside the Windows Subsystem for Linux (Bash shell) now create folders with the case sensitive flag set. So, whether you use the mkdir
command to create a directory inside a Bash shell or a development tool does it for you, the created directory is automatically set as case sensitive—even if you create it on your mounted Windows file system.
现在,您可以在Windows子系统(Bash shell)中运行的Linux工具创建带有区分大小写标志的文件夹。 因此,无论您使用mkdir
命令在Bash shell内创建目录还是使用开发工具为您创建目录,创建的目录都会自动设置为区分大小写,即使您在已安装的Windows文件系统上创建了目录也是如此。
Technically, this occurs because the DrvFs file system for the Linux environment uses the case=dir
flag by default. The case=dir
option sets the Linux environment to respect each directory’s NTFS flag, and to automatically set the case sensitivity flag on directories created from within the Linux environment. You can change this option in your wsl.conf file, if you like.
从技术上讲,这是因为默认 case=dir
用于Linux环境的DrvFs文件系统使用case=dir
标志。 case=dir
选项将Linux环境设置为尊重每个目录的NTFS标志,并自动在从Linux环境中创建的目录上设置区分大小写标志。 如果愿意,可以在wsl.conf文件中更改此选项。
As long as you create folders from the Linux environment, they’re created with the proper case sensitivity settings and you never need to touch the fsutil.exe command.
只要您在Linux环境中创建文件夹,便会使用适当的区分大小写设置创建文件夹,而您无需触摸fsutil.exe命令。
![](https://i-blog.csdnimg.cn/blog_migrate/10921f8fcca5a91da1404c3490296e93.png)
如何检查目录是否区分大小写 (How to Check if a Directory is Case Sensitive)
To check whether a directory is currently case sensitive, run the following command, replacing “C:\folder” with the path to the folder.
要检查目录当前是否区分大小写,请运行以下命令,将“ C:\ folder”替换为文件夹的路径。
fsutil.exe file queryCaseSensitiveInfo C:\folder
If case sensitivity is enabled for a directory, you’ll see that the “Case sensitive attribute on directory [path] is enabled.” If the directory is using the standard Windows case insensitivity, you’ll see that the “Case sensitive attribute on directory [path] is disabled.”
如果为目录启用了区分大小写,您将看到“目录[path]上的区分大小写属性已启用。” 如果目录使用标准的Windows不区分大小写,则将看到“目录[path]上的区分大小写属性已禁用。”
![](https://i-blog.csdnimg.cn/blog_migrate/af4eda5cb319a0b1a6f39b30c2d45a5a.png)
如何使目录不区分大小写 (How to Make a Directory Case Insensitive)
To undo your change and make a directory case insensitive once again (as Bill Gates intended it), run the following command, replacing “C:\folder” with the path to the folder.
要撤消更改并使目录再次不区分大小写(如Bill Gates所期望的),请运行以下命令,将“ C:\ folder”替换为文件夹的路径。
fsutil.exe file setCaseSensitiveInfo C:\folder disable
![](https://i-blog.csdnimg.cn/blog_migrate/88d4c881b7ea893aea5aa23659ea86b3.png)
If you try to disable case sensitivity for a folder that contains files with names that would collide, you’ll see an “Error: The directory is not empty” message. You’ll need to remove or rename the conflicting files before continuing.
如果您尝试为包含名称冲突的文件的文件夹禁用区分大小写,则会看到“错误:目录不为空”消息。 您需要先删除或重命名有冲突的文件,然后再继续。
![](https://i-blog.csdnimg.cn/blog_migrate/55e7abe2680954bda35e458766fc0454.png)
翻译自: https://www.howtogeek.com/354220/how-to-enable-case-sensitive-folders-on-windows-10/
启用tim无法访问文件夹