How to show hidden files (dotfiles) with windows powershell

WindowsPowershellDotfiles

Windows Problem Overview


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.

Windows Solutions


Solution 1 - Windows

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionfumaView Question on Stackoverflow
Solution 1 - WindowsfumaView Answer on Stackoverflow