Set-Location command in PowerShell is used to set the location of the drive from the current directory. The drive could be the local drive, folder path, shared path, registry, or any environmental variable.
This command is very useful while writing the script because many times we need multiple files from the same folder and each time we need to mention the full path. This command allows us to set the path at the beginning of the script and then we can directly browse the path from the current directly.
PS C:\> Set-Location C:\Temp\ -PassThru Path ---- C:\Temp
PS C:\> Set-Location HKLM:\ PS HKLM:\>
PS C:\> Set-Location Env:\ PS Env:\>
PS C:\> Set-Location Cert:\ PS Cert:\>