Using this parameter does not change the current location. To indicate the unnamed default location stack, type $null or an empty Specifies an existing location stack name that this cmdlet makes the current location stack. For more information on navigating with -/ +, see the Path parameter. Using the alias, cd - or cd + is an easy way to navigate through your location history while # Navigate using the Set-Location alias "cd" and the implicit positional Path parameter # Navigate back through the history using "-" Example 5: Navigate location history using `+` or `-` PS C:\> Set-Location -Path $env:SystemRoot For information about location stacks, see the Notes. The *-Location cmdlets use the current location stack unless a different location stack is The third command displays the locations in the current location stack. The second command makes the Paths location stack the current location stack. The first command adds the current location to the Paths stack. PS C:\Program Files\PowerShell\> Get-Location -Stack PS C:\Program Files\PowerShell\> Set-Location -StackName "Paths" Example 4: Set the current location to a named stack PS C:\> Push-Location -Path 'C:\Program Files\PowerShell\' -StackName "Paths" To get the current location in the PSDrive use Get-Location -PSDrive command. The location to the current location in the PSDrive. When the drive name is specified in the form : (without backslash), the cmdlet sets The second command sets the location to the current location of the C: drive in the FileSystem The first command sets the location to the root of the HKLM: drive in the Registry provider. Example 3: Set location to the current location in the C: drive PS C:\Windows\> Set-Location HKLM:\ Parameter to direct PowerShell to return a PathInfo object that represents the Env:\ location. This command sets the current location to the root of the Env: drive. Example 2: Set the current location and display that location PS C:\> Set-Location -Path "Env:\" -PassThru This command sets the current location to the root of the HKLM: drive. Examples Example 1: Set the current location PS C:\> Set-Location -Path "HKLM:\" Independent from the location stack that is accessed using the StackName parameter. Maintains a history of the last 20 locations that can be accessed with - and +. PowerShell 6.2 added support for - and + as a values for the Path parameter. That location could beĪ directory, a subdirectory, a registry location, or any provider path. The Set-Location cmdlet sets the working location to a specified location. Sets the current working location to a specified location.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |