Windows PowerShell equivalent to Unix/Linux `pwd`?
PowerShell has many of the same commands as Linux. pwd
is the command equivalent.
When you type pwd
in Powershell, it is an alias to Get-Location
.
In addition to Get-Location
and its Aliases, you can also use the automatic variable $pwd
.
The $pwd
variable is nice because you have direct access to the PathInfo members. E.g.
$pwd.Path.PadLeft(80)
$pwd.Drive
And if you ever want to know what members there are you can just pipe the command\alias to Get-Member
:
PS C:\Users\your-name-here\Desktop> pwd|Get-Member
TypeName: System.Management.Automation.PathInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Drive Property System.Management.Automation.PSDriveInfo Drive {get;}
Path Property System.String Path {get;}
Provider Property System.Management.Automation.ProviderInfo Provider {get;}
ProviderPath Property System.String ProviderPath {get;}
Get-Location
cmdlet should do the trick
As Thiago mentioned, you can use these aliases: gl
or pwd