如何使用windows powershell显示隐藏文件(dotfiles)

fum*_*uma 18 windows powershell dotfiles

当我有隐藏文件,如dotfiles.git目录时:如何在Powershell中列出这些文件和目录?

既没有Get-ChildItem,dirls没有表现出来.

fum*_*uma 34

要显示此类隐藏文件,请使用-ForceGet-Childitem命令的参数.

Get-ChildItem . -Force
Run Code Online (Sandbox Code Playgroud)

您也可以使用其别名 -Force

dir -Force
ls -Force
gci -Force
Run Code Online (Sandbox Code Playgroud)

另外:如果你想删除完全删除,例如.git目录,你可以使用Delete-Item .\.git -Force

编辑

根据Get-Help Get-ChildItem -Examples"示例3",这也有效: dir -att h, !h

  • 你也可以做 `dir -Fo` `ls -Fo` `gci -Fo` (6认同)
  • `Get-ChildItem -Attributes Hidden,!Hidden`如果你想输入 (3认同)
  • “ ls -at h”将是最短的 (2认同)
  • -force 和 -FORCE 也起作用。 (2认同)
  • 谢啦。@ricardoNava。这显然让事情变得简单多了。 (2认同)