Visual studio code VS代码窗口中的默认终端 我已经有一段时间在VS代码中运行C++程序了。它基本上是一个tasks.json,看起来像这样 "tasks": [ { "label": "Compile and run", "type": "shell", "command": "", "args": [ "g++", "${fileBasename}", "-o", "test", "&&", ... } "tasks": [ { "label": "Compile and run", "type": "shell", "command": "", "args": [ "g++", "${fileBasename}", "-o", "test", ";", "cmd", "/c", "'test.exe < input.txt > output.txt'", ";", "del", "*exe", ";", "del", "${fileBasename}" } ]
我还保留了一个settings.json来定义要使用的终端,即命令提示符, 由于某些原因,在最新的VS代码更新中,我的设置被弄乱了,不再工作 我想知道将Visual studio code VS代码窗口中的默认终端 我已经有一段时间在VS代码中运行C++程序了。它基本上是一个tasks.json,看起来像这样 "tasks": [ { "label": "Compile and run", "type": "shell", "command": "", "args": [ "g++", "${fileBasename}", "-o", "test", "&&", ... } "tasks": [ { "label": "Compile and run", "type": "shell", "command": "", "args": [ "g++", "${fileBasename}", "-o", "test", ";", "cmd", "/c", "'test.exe < input.txt > output.txt'", ";", "del", "*exe", ";", "del", "${fileBasename}" } ],visual-studio-code,vscode-settings,vscode-tasks,Visual Studio Code,Vscode Settings,Vscode Tasks,我还保留了一个settings.json来定义要使用的终端,即命令提示符, 由于某些原因,在最新的VS代码更新中,我的设置被弄乱了,不再工作 我想知道将cmd定义为运行任务的终端的正确语法,因为像&&这样的东西在powershell中不起作用在我的评论之后,我做了更多的挖掘,发现下面的内容适用于我的vs代码任务问题。我只需将&更改为
cmd
定义为运行任务的终端的正确语法,因为像&&
这样的东西在powershell中不起作用在我的评论之后,我做了更多的挖掘,发现下面的内容适用于我的vs代码任务问题。我只需将&
更改为对于输入输出重定向,我使用了这个。现在我的tasks.json如下所示
"tasks": [
{
"label": "Compile and run",
"type": "shell",
"command": "",
"args": [
"g++",
"${fileBasename}",
"-o",
"test",
"&&",
...
}
"tasks": [
{
"label": "Compile and run",
"type": "shell",
"command": "",
"args": [
"g++",
"${fileBasename}",
"-o",
"test",
";",
"cmd",
"/c",
"'test.exe < input.txt > output.txt'",
";",
"del",
"*exe",
";",
"del",
"${fileBasename}"
}
]
“任务”:[
{
“标签”:“编译并运行”,
“类型”:“外壳”,
“命令”:“,
“args”:[
“g++”,
“${fileBasename}”,
“-o”,
“测试”,
";",
“cmd”,
“/c”,
“'test.exeoutput.txt'”,
";",
“德尔”,
“*exe”,
";",
“德尔”,
“${fileBasename}”
}
]
我不知道可视化代码中的任务
,但是&
似乎可以工作,请参阅:
也可以在powershell中工作。当我说
时,我的意思是它们不适用于输入输出重定向,g++ECODOWN.cpp-o test;testoutput.txt;
这里有一个cmd供参考这可能是他lp:@Luuk是的,这也有效