In follow-up to the cmd.exe question, what is the PowerShell equivalent to echo %cd%, or Linux/Unix pwd?

link|improve this question

feedback

3 Answers

up vote 7 down vote accepted

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.

link|improve this answer
1  
"that was easy" .. boy do I feel sheepish :) – warren Jun 9 '11 at 14:03
feedback

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
link|improve this answer
very cool! I need to find a good tutorial introduction to PowerShell – warren Jun 9 '11 at 14:04
1  
Hover over the Powershell tag in your question. Click the FAQ link. Look at the second item in the list. – EBGreen Jun 9 '11 at 14:19
feedback

Get-Location cmdlet should do the trick

As Thiago mentioned, you can use these aliases: gl or pwd

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.