How to show hidden files (dotfiles) with windows powershell [duplicate]

自作多情 提交于 2020-06-09 15:56:12

问题


When I have hidden files, like dotfiles or a .git directory: How can I list those files and directories in Powershell?

Neither Get-ChildItem, dir nor ls seem to show them.


回答1:


In order to show such hidden files, use the -Force parameter for the Get-Childitem command.

Get-ChildItem . -Force

You also can use its aliases, with -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

EDIT

According to Get-Help Get-ChildItem -Examples "Example 3" this also works: dir -att h, !h



来源:https://stackoverflow.com/questions/50817139/how-to-show-hidden-files-dotfiles-with-windows-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!