且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将CMD命令转换为VS代码命令

更新时间:2023-02-16 22:11:37

开始$ {fileDirname} \ $ {fileBasenameNoExtension} .exe 是一个shell命令,因此您可以使用以下命令运行它:

start ${fileDirname}\${fileBasenameNoExtension}.exe is a shell command, so you could run it with:

"multiCommand.commands": [
  {
    "command": "multiCommand.build_and_run",
    "sequence": [
        "workbench.action.tasks.build",
        // "\"start ${fileDirname}\\${fileBasenameNoExtension}.exe\"",
        {
          "command": "workbench.action.terminal.sendSequence",
          "args": {
            "text": "start ${fileDirname}\\${fileBasenameNoExtension}.exe"
           }
        }
     ]
  }
]

我不知道该顺序是否一定要保证是顺序的。您必须进行测试-如有必要,您始终可以添加 interval 选项。还有一些外壳运行程序扩展可以插入多命令中。 多命令不能单独运行没有 sendSequence 或通过另一个shell运行程序扩展程序的命令的shell命令。

I don't know that that sequence is necessarily guaranteed to be sequential though. You'll have to test that - you could always add the interval option if necessary. There are also shell runner extensions that could be plugged into multi-command. multi-command can't just run shell commands by itself without sendSequence or through another shell runner extension's commands.