区分大小写的背景
Linux上是可以区分大小写的,比如可以在Linux上创建abc和ABC两个文件;Mac OS上是可以通过配置实现区分文件的大小写的;但在Windows上是不能实现的。

对于经常处理Git事务的童鞋们来说,区分文件的大小写是非常有必要的。

(1)以管理员身份运行cmd.exe

fsutil.exe file SetCaseSensitiveInfo C:\Users\walterlv\GitDemo enable

是的,就是上面这一段非常简单而容易理解的命令即可开启单个文件夹的名称区分大小写功能。只是单个文件夹!如果需要开启其他文件夹,需要多次执行这样的命令。

而如果需要关闭对此文件夹的大小写支持,只需要将 enable 改为 disable

fsutil.exe file SetCaseSensitiveInfo C:\Users\walterlv\GitDemo disable
区分大小写的效果

看!以上就是在 Windows 10 系统级开启了大小写敏感的我的一个 Git 仓库,这下可以让跨平台的 Git 工作起来在各个系统都一样了。

注意事项

以上命令的正确运行需要以下条件,缺一不可:

  1. Windows 10 四月更新(1803)
  2. 安装有 Linux 子系统,即 Windows Subsystem for Linux
  3. 所在分区为 NTFS 格式
  4. 以管理员权限运行 PowerShell

fsutil file 支持的命令:

fsutil.exe file
---- FILE Commands Supported ----

createNew                Creates a new file of a specified size
findBySID                Find a file by security identifier
layout                   Query all the information available about the file
optimizeMetadata         Optimize metadata for a file
queryAllocRanges         Query the allocated ranges for a file
queryCaseSensitiveInfo   Query the case sensitive information for a directory
queryExtents             Query the extents for a file
queryExtentsAndRefCounts Query the extents and their corresponding refcounts for a file
queryFileID              Queries the file ID of the specified file
queryFileNameById        Displays a random link name for the file ID
queryOptimizeMetadata    Query the optimize metadata state for a file
queryValidData           Queries the valid data length for a file
setCaseSensitiveInfo     Set the case sensitive information for a directory
setShortName             Set the short name for a file
setValidData             Set the valid data length for a file
setZeroData              Set the zero data for a file
setEOF                   Sets the end of file for an existing file
setStrictlySequential    Sets ReFS SMR file as strictly sequential

fsutil 支持的命令:

fsutil.exe
---- Commands Supported ----

8dot3name       8dot3name management
behavior        Control file system behavior
dax             Dax volume management
dirty           Manage volume dirty bit
file            File specific commands
fsInfo          File system information
hardlink        Hardlink management
objectID        Object ID management
quota           Quota management
repair          Self healing management
reparsePoint    Reparse point management
resource        Transactional Resource Manager management
sparse          Sparse file control
tiering         Storage tiering property management
transaction     Transaction management
usn             USN management
volume          Volume management
wim             Transparent wim hosting management

————————————————
原文链接: https://walterlv.com/post/case-sensitive-in-windows-file-system.html

转载请注明转自: 听风 , 本文固定链接: (转)Win10实现文件名区分大小写