Exploring File System Navigation Manipulation

The most common cmdlets that we are going to use for file system navigation and manipulation are cd, mkdir, Set-Location etc.

mkdir is used to create a new directory as shown in screenshot below:

As shown in screenshot above, a new directory called MyDirectory is created under the current location i.e. C drive. In powershell, mkdir and New-Item both can be used to create a new directory with the difference being that mkdir is a function that uses New-Item internally to create the directory:

Next, Get-Item cmdlet is used to get the item at specified location whose name we supply as a parameter for the cmdlet. For example, Get-Item MyDirectory will return the details related to directory MyDirectory:

Below is the list of parameters for Get-Item cmdlet:









You can use Get-Item to get specific properties of directory as shown in screenshot below:

. in the Get-Item represents current directory and we are accessing LastAccessTime property of the current directory.

Get-ChildItem cmdlet is used to list all the child items present in the current directory.

AS shown in screenshot above, no results are returned by Get-ChildItem as MyDirectory is empty as of now. Screenshot below shows the result of Get-ChildItem when executed on a non-empty directory/drive:

You can use the -Recurse parameter to get items in all child containers and use the -Depth parameter to limit the number of levels to recurse. A location can be a file system location, such as a directory, or a location exposed by a different PowerShell provider, such as a registry hive or a certificate store.

Below is the list of all the parameters of Get-ChildItem:















- FollowSymlink

Set-Location cmdlet is used to change the current execution/working location to some specified location on system. That location could be a directory, a sub-directory, a registry location, or any provider path.


In powershell cd and Set-Location are the same. You can verify the same by using Get-Alias: