Monday, January 19, 2009

get all items

[] to get all items within a folder

PS> Get-ChildItem -Force C:\

[] to to list everything on the C drive

PS> Get-ChildItem -Force C:\ -Recurse

[] to find all executables within the Program Files folder that were last modified after October 1, 2005 and which are neither smaller than 1 megabyte nor larger than 10 megabytes

PS> Get-ChildItem -Path $env:ProgramFiles -Recurse -Include *.exe
| Where-Object -FilterScript {($_.LastWriteTime -gt "2005-10-01") -and ($_.Length -ge 1m) -and ($_.Length -le 10m)}

No comments:

Post a Comment