Powershell for FileSystem to list the file files

PowerShell script to list the DLL files under the system32 folder

Example


# PowerShell script to list the DLL files under the system32 folder
$Dir = get-childitem C:\windows\system32 
$List = $Dir | where {$_.extension -eq ".dll"}
$List 
 

Copy and Try it



PowerShell Script to List Files with particular extension ".dll" with formatted output

Example


# PowerShell script to list the DLL files under the system32 folder
$Dir = get-childitem C:\windows\system32 
$List = $Dir | where {$_.extension -eq ".dll"}
$List | format-table name
 

Copy and Try it


If search "-Recurse" option you could get error you don't have permission to access. the entire search is aborted because the process exits.
Try to set the ErrorAction parameter to Continue or SilentlyContinue

Example


# PowerShell script to list the DLL files under the system32 folder
$Dir = get-childitem C:\windows\system32 -Recurse
$List = $Dir | where {$_.extension -eq ".dll"}
$List | format-table name
 

Copy and Try it