# PowerShell Cheat Sheet ###### tags: `powershell, cheat sheet` > powershell commands notes :bulb::rocket: ## Commands #### Search a directory or file ( Get-ChildItem ) * specific path ( -Path C:\PATH\ ) * string patterns to be matched including folder titles ( -Include \*WORD\* ) * recursive search ( -Recurse ) * include hidden files ( -Force ) ```powershell Get-ChildItem -Path C:\Windows\System32\ -Include *power* -Recurse -Force ``` ![](https://i.imgur.com/hz3sm18.png) * ignore errors (shows in red) of directories or files that I do not have access ( -ErrorAction SilentlyContinues) ```powershell Get-ChildItem -Path C:\Windows\System32\ -Include *power* -Recurse -Force -ErrorAction SilentlyContinue ``` ![](https://i.imgur.com/0dLTaBA.png) * show only files ( -File ) * Output results to a file in a specific path ( | Out-File -FilePath C:\PATH\file.txt ) ```powershell Get-ChildItem -Path C:\Windows\System32\ -Include *power* -Recurse -Force -ErrorAction SilentlyContinue -File | Out-File -FilePath C:\file.txt ``` ![](https://i.imgur.com/Bx4LIJS.png) ![](https://i.imgur.com/VTPdjOG.png) :::info :pushpin: References * [docs.microsoft.com](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-7.2) * [devblogs.microsoft.com](https://devblogs.microsoft.com/scripting/use-windows-powershell-to-search-for-files/) :::