I created a folder in my user directory, C:\Users\myname\someproject
I then created a task in this folder
// C:\Users\myname\someproject\.vscode\tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "show project dir",
"type": "shell",
"command":"pwd",
}
]
}
When I run this task, I get the following output
> Executing task: pwd <
Path
----
C:\Users\myname
Terminal will be reused by tasks, press any key to close it.
I was expecting it to print the directory of the project, not my home directory. Why is it not printing out the project dir?
Turns out that my powershell "profile" ran this command:
# C:\Users\myname\Documents\WindowsPowerShell\Microsoft.Powershell_profile.ps1
Set-Location ~
So whenever a terminal was launched (including when a task is run) then the terminal cd'ed to home directory.