VSCode构建任务将打开外壳并在不运行命令的情况下停止

时间:2018-11-19 18:05:40

标签: batch-file cmd visual-studio-code vscode-settings vscode-tasks

我目前正在尝试运行build.bat脚本,该脚本使用VSCode构建任务来构建我的解决方案。不幸的是,它所做的只是打开命令提示符,而没有按照说明运行实际命令。我当前正在尝试运行的任务是

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "windows": {
                "options": {
                    "cwd": "W:\\handmade\\code",
                    "shell": {
                        "args": [
                            "/k W:\\handmade\\misc\\shell.bat"
                        ]
                    }
                },
                "command": "build.bat",
            },
            "problemMatcher": [
                "$gcc"
            ]
        }
    ]
}

我期望的输出是:

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.8.4
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

W:\handmade\code>build.bat
A subdirectory or file ..\..\build already exists.
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26729 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

win32_handmade.cpp
Microsoft (R) Incremental Linker Version 14.15.26729.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:win32_handmade.exe
/debug
win32_handmade.obj
user32.lib

如果我正常运行命令,将会得到什么,相反,我得到的是

> Executing task: build.bat <

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.8.4
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

W:\handmade\code>

然后挂起,直到调用exit。显然从来没有尝试过执行task.json文件中提供的命令,而我为什么要这样做呢?

0 个答案:

没有答案