9.3. Using the set-location Cmdlet
Once you find supported drives with Windows PowerShell, you will likely want to navigate around in them. You use the set-location cmdlet to do that. To simplify the use of providers and drives, Windows PowerShell defines several aliases.
To find the aliases for set-location on your system, type this command:
get-alias |
where-object {$_.Definition -eq "set-location"}
The results are shown in Figure 9-5. Whether you use sl, cd or chdir is your choice.
Figure 9.5. Figure 9-5
The get-alias cmdlet with no parameters returns objects representing all aliases on the current system. The where-object cmdlet in the second step of the pipeline filters those so that only those whose Definition property has the value of set-location are passed on to the default formatter.
The set-location cmdlet supports the following parameters in addition to the common parameters:
path — Specifies the path for the new working location. This is a positional parameter in position 1. The default is the empty string.
literalPath — Specifies a path. The value of this parameter is to be interpreted literally. In other words, any wildcard characters in the path are treated literally.
passthru — Specifies that the object created by the cmdlet is to be passed along the pipeline.
stackname — Specifies the stack to which the location is being set. If no value is specified, then the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access