Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
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 - Fatal编程技术网

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 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代码任务问题。我只需将&更改为

我还保留了一个settings.json来定义要使用的终端,即命令提示符, 由于某些原因,在最新的VS代码更新中,我的设置被弄乱了,不再工作

我想知道将
cmd
定义为运行任务的终端的正确语法,因为像
&&
这样的东西在powershell中不起作用

在我的评论之后,我做了更多的挖掘,发现下面的内容适用于我的vs代码任务问题。我只需将
&
更改为

"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是的,这也有效