Getting ready

Ensure that you are at a location that has a few files. List out the contents of the current directory and count the number of items returned. If the number is less than five, you may want to consider adding more items to the directory.

  1. Enter the following command to count the number of files and directories at the current path.
PS> (Get-ChildItem -Path .).Count
  1. If you would like to reduce keystrokes, given that we are only running commands at the terminal, you could use the alias and the defaults of the cmdlet.
PS> (gci).Count
Those parentheses are required; the parentheses work almost similar to how they work in mathematics: the instruction within the parentheses is processed first. In this case, we want gci executed first, and then, the Count property from within the returned object picked.
  1. Get the list of parameters Select-Object has.
PS> Get-Help Select-Object

We see parameters like, First and Last, and they accept integer values.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.254.35