Hi everyone.
Sometime, while using our regular or favourite cmdlets, we often forget to use non-regular, non-common cmdlets. When you look in to all cmdlets which powershell offers, you can see there may be few cmdlets which you never used and never notice them.
One of the cmdlet which i came to know is “Get-Location” whose alias is “pwd” (present working directory)
As its name defines , when you run it, it shows your location (not GPS one :D ), it shows you that in which folder you currently working in.
this cmdlet is very useful when you want to record you current folder location in to the powershell scripts.
This cmdlet has three main properties.
- Path
- Drive
- Provider
To check these properties we can put Get-Location in to a variable.
$location = Get-Location
to know the path of the current location we can type $location.Path property.
To know the name and other information, we can use $location.Drive property.
to know the PS Provider type, we can use $location.Provide property.
That’s all for now. :)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.