You can change the directory in any PowerShell provider using the Set-Location, Push-Location, or Pop-Location cmdlets. You can also use the standard cd command from Windows cmd as it is an alias for Set-Location.

To change the directory to the scripts directory. You could use the following command.

cd C:\scripts

The equivalent of this command is to use the full Set-Location command name.

Set-Location C:\scripts

Finally, you can use Push-Location and Pop-Location to move in and out of directories. Push-Location works just like Set-Location but stores the history of the previous directory.

To move into a directory with Push-Location, just do this.

Push-Location C:\scripts

To move back to the previous directory, use Pop-Location. It doesn’t require any arguments.

Pop-Location