title: Working directory of Visual Studio Code tasks
body: <p>What is the working directory of a Visual Studio Code task?</p>
  <p>According to the official documentation, the default should be the workspace directory, i.e., <code>workspaceFolder</code>, but running a task which simply executes <code>echo $PWD</code>, it shows the parent directory of <code>workspaceFolder</code>.</p>
  <p>In other words, given <code>dir1/dir2/.vscode/tasks.json</code>, the following trivial task prints <code>dir1</code> while the <code>workspaceFolder</code> refers to <code>dir2</code> (the actual workspace directory).</p>
  <p>What should I do to run a task from the <code>workspaceFolder</code>? Changing the <code>cwd</code> option does not help.</p>
  <p><code>tasks.json</code>:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;version&quot;: &quot;2.0.0&quot;,
      &quot;tasks&quot;: [
          {
              &quot;type&quot;: &quot;shell&quot;,
              &quot;label&quot;: &quot;Sample&quot;,
              &quot;command&quot;: &quot;echo PWD=$PWD workspaceFolder=${workspaceFolder}&quot;,
              &quot;options&quot;: {
                &quot;cwd&quot;: &quot;${workspaceFolder}&quot;
              }
          }
      ]
  }
  </code></pre>
  <p>Execution output:</p>
  <pre class="lang-console prettyprint-override"><code>&gt; Executing task: echo PWD=$PWD workspaceFolder=/home/ubuntu/dir1/dir2 &lt;
  
  PWD=/home/ubuntu/dir1 workspaceFolder=/home/ubuntu/dir1/dir2
  </code></pre>
  <p>As additional and probably relevant note, I am developing remotely using the <em>Remote - SSH</em> extension.</p>