What exactly does the Resolve-Path cmdlet do?
<p>I've started working with Powershell lately on my Windows 10 system. I've created a profile file, and I wanted to put in a variable which links to a folder in my documents section. However, I didn't want to hard-code the path because I knew I'd need to go in and re-write it if my profile name got changed in a hard drive transfer like it did the last time I sent it in for repairs. So my first thought was to put in something like this:</p>

<pre><code>$Var = $(~\Documents\Folder)
</code></pre>

<p>But that spat back an error. Then I learned of the Resolve-Path Cmdlet, which appeared at a glance to be what I needed. However, when I did this:</p>

<pre><code>$Var = $(Resolve-Path ~\Documents\Folder)
</code></pre>

<p>... I got this:</p>

<pre><code>&gt;$Var

Path
----
C:\Users\Username\Documents\Folder

&gt;
</code></pre>

<p>Which seemed like a problem. However, when I tried to <code>cd $Var</code>, it worked successfully, which confused me greatly. I figured that the extraneous <code>Path</code> header in the result would cause an error.</p>

<p>What exactly does <code>Resolve-Path</code> <em>do</em>, and why does it still get interpreted correctly when passed into <code>cd</code>? And additionally, is there any way to make <code>Resolve-Path</code> <em>not</em> include the extraneous information and return only the expanded path?</p>