如何使用 windows powershell 显示隐藏文件(点文件)
How to show hidden files (dotfiles) with windows powershell
当我有隐藏文件时,例如 dotfiles 或 .git
目录:
如何在 Powershell 中列出这些文件和目录?
Get-ChildItem
、dir
和 ls
似乎都没有显示它们。
为了显示此类隐藏文件,请为 Get-Childitem
命令使用 -Force
参数。
Get-ChildItem . -Force
您也可以使用它的别名,-Force
dir -Force
ls -Force
gci -Force
另外:如果你想完全删除,例如.git目录,你可以使用Delete-Item .\.git -Force
编辑
根据 Get-Help Get-ChildItem -Examples
"Example 3" 这也适用:
dir -att h, !h
当我有隐藏文件时,例如 dotfiles 或 .git
目录:
如何在 Powershell 中列出这些文件和目录?
Get-ChildItem
、dir
和 ls
似乎都没有显示它们。
为了显示此类隐藏文件,请为 Get-Childitem
命令使用 -Force
参数。
Get-ChildItem . -Force
您也可以使用它的别名,-Force
dir -Force
ls -Force
gci -Force
另外:如果你想完全删除,例如.git目录,你可以使用Delete-Item .\.git -Force
编辑
根据 Get-Help Get-ChildItem -Examples
"Example 3" 这也适用:
dir -att h, !h