Course Overview

/

Navigating File Systems

Navigating File Systems

Listing Directory Contents

PowerShell as covered, within Intro to PowerShell, uses alias's, however, there is a cmdlet that can be used to natively list files within a file system:

  • Get-ChildItem

Get-ChildItem will return the contents of the directory you are in, see below for example output:

The alias's that are associated with Get-ChildItem and would achieve the same result are as follows:

  • ls
  • gci
  • dir

Printing Your Working Directory

Although, the directory is usually stated on the left-hand side, like so:

There is a cmdlet that can be used to print/view the current working directory you are operating within:

  • Get-Location

Changing Directory

Within any terminal or command prompt usage there will always be a need to change the working directory to another location, whether is to retrieve a file or to view the contents of a directory, etc.  The cmdlet to enable this function is as follows:

  • Set-Location  

Set-Location is very similar to "cd" within Linux terminal and CMD within Windows, in fact, there are alias's set up within PowerShell to allow the continued use of "cd". However, the official cmdlet is Set-Location, see below for example output: