【发布时间】:2021-08-17 21:55:12
【问题描述】:
我已经设置了一段时间以在 VS Code 中运行 C++ 程序。它基本上是一个tasks.json,看起来像这样
"tasks": [
{
"label": "Compile and run",
"type": "shell",
"command": "",
"args": [
"g++",
"${fileBasename}",
"-o",
"test",
"&&",
...
}
我还保留了一个 settings.json 来定义要使用的终端,即命令提示符, 出于某种原因,在 VS Code 的最新更新中,我的设置变得一团糟,它不再工作了。
我想知道将cmd 定义为运行任务的终端的正确语法,因为&& < > 在powershell 中不起作用
【问题讨论】:
-
我对 Visual Code 中的
tasks一无所知,但&&似乎可以工作,请参阅:How do I run multiple commands on one line in PowerShell? 和< and >也可以在 powershell 中工作。 -
当我说
< and >我的意思是它们不适用于输入输出重定向,g++ ECODOWN.cpp -o test ; test < input.txt > output.txt;这里是一个 cmd 供参考 -
@Luuk 是的,这也有效
标签: visual-studio-code vscode-settings vscode-tasks