List-Executables
Lists all executables in a dir tree
param([string]$path = "$PWD")
try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Progress "Listing executables within $path ..."
$path = Resolve-Path "$path"
[int]$count = 0
Get-ChildItem "$path" -attributes !Directory -recurse -force | Where-Object { $_.Name -like "*.exe" } | ForEach-Object {
"$($_.FullName)"
$count++
}
Write-Progress -completed " "
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"? Found $count executables within ??$path in $elapsed sec."
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}Specifies the path to the directory tree (current working directory by default)