如何使用Windows PowerShell显示隐藏文件(dotfiles) [英] How to show hidden files (dotfiles) with windows powershell
问题描述
当我有隐藏文件(例如 dotfiles 或.git
目录)时:
如何在Powershell中列出这些文件和目录?
When I have hidden files, like dotfiles or a .git
directory:
How can I list those files and directories in Powershell?
Get-ChildItem
,dir
和ls
都没有显示它们.
Neither Get-ChildItem
, dir
nor ls
seem to show them.
推荐答案
为显示此类隐藏文件,请对Get-Childitem
命令使用-Force
参数.
In order to show such hidden files, use the -Force
parameter for the Get-Childitem
command.
Get-ChildItem . -Force
您还可以在-Force
dir -Force
ls -Force
gci -Force
也:如果您想完全删除,请删除 .git目录,则可以使用Delete-Item .\.git -Force
Also: if you want to delete fully delete e.g. the .git Directory, you may use Delete-Item .\.git -Force
编辑
根据Get-Help Get-ChildItem -Examples
示例3",此方法也适用:
dir -att h, !h
According to Get-Help Get-ChildItem -Examples
"Example 3" this also works:
dir -att h, !h
这篇关于如何使用Windows PowerShell显示隐藏文件(dotfiles)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!