Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using visual studio code and running tasks where path to .exe contains a space

I am following the walkthrough from the microsoft docs for using typescript in a vs code project. When I try and run the build task, the terminal comes up with

Executing task: c:\whatever\my path with spaces\Projects\ProjectName\node_modules.bin\tsc.cmd -p "c:\whatever\my path with spaces\Projects\ProjectName\tsconfig.json"

and the error

'c:\whatever\my' is not recognized as an internal or external command,

That is, the space in the folder name is confusing the task runner. I need something like

call "c:\whatever\my path with spaces\Projects\ProjectName\node_modules\.bin\tsc.cmd" -p "c:\whatever\my path with spaces\Projects\ProjectName\tsconfig.json"

How do I set up VS Code so the terminal recieves an input it can interpret with spaces in the directory name? Thank you

current tasks.json:

"version": "2.0.0",
"tasks": [
    {
        "type": "typescript",
        "tsconfig": "tsconfig.json",
        "problemMatcher": [
            "$tsc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]
like image 686
Brent Avatar asked Jan 30 '18 03:01

Brent


1 Answers

You should use quotation marks \" (slash + quotation mark) for the entire command as in

"command": "\"c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe\"",
like image 80
Thomas Kintzel Avatar answered Oct 06 '22 09:10

Thomas Kintzel