What is the use of -Force parameter in Get-ChildItem in PowerShell?



To display files along with hidden files, you need to use –Force parameter.

Command

Get-ChildItem D:\Temp\ -Force

Output

If you see the above output, hiddenfile.xlsx is the hidden file and same can be identified with the mode where –a-h—attribute of the file.

You can also use this parameter with –Recurse or –Depth.

Get-ChildItem D:\Temp\ -Recurse -Force

Advertisements