Bre*_*ent 6 visual-studio-code
我正在按照Microsoft文档中的演练来介绍在vs代码项目中使用Typescript。当我尝试运行构建任务时,终端会显示
执行任务:c:\ whatever \ my带有空格的路径\ Projects \ ProjectName \ node_modules.bin \ tsc.cmd -p“ c:\ whatever \ my带有空格的路径\ Projects \ ProjectName \ tsconfig.json”
和错误
'c:\ whatever \ my'不被识别为内部或外部命令,
也就是说,文件夹名称中的空格使任务运行程序感到困惑。我需要类似的东西
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"
Run Code Online (Sandbox Code Playgroud)
如何设置VS Code,以便终端接收到可以解释的输入,其中目录名称中可以包含空格?谢谢
当前的task.json:
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
Run Code Online (Sandbox Code Playgroud)
您应该对整个命令使用引号\"(斜杠 + 引号),如下所示
"command": "\"c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe\"",
Run Code Online (Sandbox Code Playgroud)
或者如果使用反斜杠
"command": "\"c:\\tools\\my tool folder\\test.exe\"",
Run Code Online (Sandbox Code Playgroud)
请注意,命令末尾有引号(一个用于 json 字符串,一个用于定义包含空格的路径)
| 归档时间: |
|
| 查看次数: |
774 次 |
| 最近记录: |