Windows PowerShell has a series of commands to set a syntax from the console. Not only does this system allow the use of this console, but it is also possible to download and install PowerShell in Linux in order to automate processes. If you want to get the hidden files we recommend you read this article with which you will learn How to show hidden files with Get-ChildItem-Hidden-File with Windows PowerShell
What is Get-ChildItem?
Get-Childtem is a command defined for PowerShell which allows to get items or children in one or more specific locations. An item refers to files or folders, while a location specifies a location or directory in the Windows file system.
‘Get-ChildItem’ cmdlet syntax and parameters
The syntax for ‘Get-ChildItem’ is as follows: Get-ChildItem –parameter argument1, -argument2 -parameter2 argument… Furthermore, the parameters include: -recurse <Switchparameter> to get child items at specific locations, -Path <String > used to indicate the paths of the locations, -name <Switchparameter> to retrieve the names of items, among others.
How to show hidden files with Get-ChildItem -Hidden -File with Windows PowerShell
It is important to note that Get-ChildItem does not allow showing hidden files by default in Windows PowerShell. However, you can use a parameter called ‘-Hidden’ which will allow you to show hidden files as well as ‘-Force’. To do so, follow the steps that we explain below.
Access Windows PowerShell
First, access Windows PowerShell from the system browser. Windows PowerShell allows you to perform various actions such as renaming the computer or viewing installed programs from the console. To access this tool, type ‘PowerShell’ in Windows search engine; If you cannot get it on your computer, you must obtain it from the official Microsoft site .
Immediately, you will see a new window that corresponds to the system console where you can insert the PowerShell commands with their respective parameters according to your requirements. If you don’t like the black background of the console, you can modify the tool by putting the transparent window in Windows 10 .
Identify the ‘-Hidden’ and ‘-Files’ parameters
For Windows PowerShell, the ‘-Hidden’ parameter allows you to show only hidden files . This attribute can be abbreviated with the letters ‘h’ or ‘ah’. By default, the ‘Get-ChildItem’ cmdlet does not show hidden items and in this circumstance it is possible to add the ‘-Force’ parameter.
For its part, the parameter ‘-File’ is used to obtain a list of files and can be abbreviated with the letters ‘af’.
Use the –Hidden parameter in Windows PowerShell
In order to use the ‘-Hidden’ parameter in Windows PowerShell you must take into account a specific directory in order to get an output. To do this, you must write the following syntax in the console: Get-ChildItem -Hidden directory.
For example, if you want to show hidden files located in the ‘Documents’ folder you can type in Windows PowerShell: Get-ChildItem C: \ Users \ computer_name \ Documents -Hidden and press the ‘Enter’ key. Replace ‘computer_name’ with the real name with which your computer is identified.
Do I need the ‘-Files’ parameter?
If you use the ‘-Hidden’ parameter, Windows PowerShell will search for all hidden files in the directory that you have indicated in the console. In this sense, it is not allowed to use the ‘Files’ parameter at the same time since a syntax error will occur when executing the statement.
Alternative to show hidden files without using Get-ChildItem-Hidden-File with Windows PowerShell
Windows PowerShell allows you to use the ‘-Force’ parameter to show hidden files . Simply, you must write the following syntax: Get-ChildItem -Force directory. Replace ‘Directory’ with the exact location where you want to search for hidden files. You can replace the directory with the operator ‘.’ (Without the quotes) to get the list of all hidden folders on the system.
How to show hidden files of a specific extension?
To show hidden files with a specific extension using Windows PowerShell , you can add the format as follows: Get –ChildItem C: \ Users \ computer_name \ Documents \ *. Ext -Hidden. Replace computer_name with the name of your PC and * .ext with the extension of the hidden files you want to show such as * .docx, * .txt, * .pdf, among others. Hit the ‘Enter’ key and watch the output