如何使用 windows powershell 显示隐藏文件(dotfiles)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50817139/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to show hidden files (dotfiles) with windows powershell
提问by fuma
When I have hidden files, like dotfilesor a .git
directory:
How can I list those files and directories in Powershell?
当我有隐藏文件(如dotfiles或.git
目录)时:如何在 Powershell 中列出这些文件和目录?
Neither Get-ChildItem
, dir
nor ls
seem to show them.
既不Get-ChildItem
,dir
也不ls
似乎显示它们。
回答by fuma
In order to show such hidden files, use the -Force
parameter for the Get-Childitem
command.
为了显示此类隐藏文件,请使用命令的-Force
参数Get-Childitem
。
Get-ChildItem . -Force
You also can use its aliases, with -Force
你也可以使用它的别名, -Force
dir -Force
ls -Force
gci -Force
Also: if you want to delete fully delete e.g. the .git Directory, you may use Delete-Item .\.git -Force
另外:如果你想完全删除例如.git Directory,你可以使用Delete-Item .\.git -Force
EDIT
编辑
According to Get-Help Get-ChildItem -Examples
"Example 3" this also works:
dir -att h, !h
根据Get-Help Get-ChildItem -Examples
“示例 3”,这也有效:
dir -att h, !h