15
3
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?
5As an add-on to this answer, %UserProfile% does not literally translate to $home, and, instead, you should use the $env:UserProfile variable. – SpellingD – 2012-07-19T15:57:45.197