Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At the cmd command prompt, this command will take me to my home directory:

cd %UserProfile%

At the PowerShell command prompt, the same command produces this error:

Set-Location : Cannot find path 'C:\%UserProfile%' because it does not exist.
At line:1 char:3
+ cd <<<<  %UserProfile%
    + CategoryInfo          : ObjectNotFound: (C:\%UserProfile%:String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

What is the equivalent command in PowerShell?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You can get to your home dir with:

cd $home

share|improve this answer
2  
As an add-on to this answer, %UserProfile% does not literally translate to $home, and, instead, you should use the $env:UserProfile variable. –  SpellingD Jul 19 '12 at 15:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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