Forrest logo
back to the tldr tool

pwsh-where:tldr:147a9

pwsh-where: View documentation for the original command.
$ tldr Where-Object
try on your machine

The "tldr" command is a utility command that is used to display concise and simplified summaries of other commands.

"Where-Object" is a command used in PowerShell, which is a command-line shell and scripting language developed by Microsoft. The purpose of the "Where-Object" command is to filter objects based on specified conditions. It allows you to select only the objects that match specific criteria from a larger set of objects.

For example, if you have a collection of files and you want to filter out only the files that were modified in the last week, you can use the "Where-Object" command along with the "LastWriteTime" property to achieve this. The command could look like this:

Get-ChildItem | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-7) }

In this example, "Get-ChildItem" retrieves a collection of all the files in the current location, and the output is then piped to the "Where-Object" command. The condition within the curly braces specifies that only files with a "LastWriteTime" greater than the date and time of one week ago should be selected.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the tldr tool