Task commands with spaces fail on Windows

vscode has not fixed this bug, maybe Cursor will? Quotes around paths with spaces are not honored when running tasks · Issue #214931 · microsoft/vscode · GitHub

Basically, on Windows, if a task command path contains a space; e.g. because default Windows home defaults to “First Last”, and you are trying to run Python from your virtual environment via “${command:python.interpreterPath}”, then the task will fail to execute, typically with a popup window saying something like “Failed to find program to open First”.

This broke in vscode a little over a year ago and Cursor’s fork inherited it. And I have had enough reports of it that I know it’s pretty common issue for folks.

Repro: make a workspace with this tasks.json under a path that contains a space

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Test Python",
      "type": "shell",
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "command": "${command:python.interpreterPath}",
      "args": ["-c", "import sys;print(sys.executable)"],
      "problemMatcher": []
    }
  ]
}