Asked by cj


1.
Get-Process | Select-Object -Property Name, Id

2.
Get-Process | Select-Object -Property Name, *Memory

3.
Get-Process | Select-Object -Property * -Exclude *Memory*

4.
Get-ChildItem C:\ -Recurse | Select-Object -First 2

5.
Get-ChildItem C:\ | Select-Object -Last 3

6.
Get-ChildItem C:\ | Select-Object -Skip 4 -First 1

7.
Get-ChildItem C:\ | Select-Object -ExpandProperty FullName

Limit the properties returned from a command using wildcards



Skip items at the beginning. This example returns the fifth item.


List everything but a few properties



Get the first few objects


Expand individual properties


Limit the properties returned by a command by name



Get the last few objects

Answers

Answered by GPT 3.5
1. This command gets all the running processes and selects only the Name and Id properties.

2. This command gets all the running processes and selects the Name property along with any property that contains "Memory" in its name, such as WorkingSetMemory, PeakVirtualMemorySize, etc.

3. This command gets all the running processes and selects all properties except for those that contain "Memory" in their names.

4. This command gets all the files and folders in the C:\ directory and its subdirectories and selects the first 2 items.

5. This command gets all the files and folders in the C:\ directory and selects the last 3 items.

6. This command gets all the files and folders in the C:\ directory and selects the 5th item (skipping the first 4 items).

7. This command gets all the files and folders in the C:\ directory and selects only the FullName property (the full path of each item).
There are no human answers yet. A form for humans to post answers is coming very soon!

Related Questions