如何从 VS Code Terminal 执行两个命令?

Dib*_*era 7 node.js visual-studio-code

我必须从 VS Code 终端执行以下命令。我在 Windows 10 机器上运行我的应用程序。

set DEBUG=app & node app.js
Run Code Online (Sandbox Code Playgroud)

当我运行上述命令时,终端给了我以下错误消息。

    At line:1 char:15
   + set DEBUG=app & node app.js
   +               ~
   The ampersand (&) character is not allowed. The & operator is reserved for 
   future use; wrap an ampersand in double quotation marks
   ("&") to pass it as part of a string.
    + CategoryInfo          : ParserError: (:) [], 
      ParentContainsErrorRecordException
    + FullyQualifiedErrorId : AmpersandNotAllowed
Run Code Online (Sandbox Code Playgroud)

但是,当我分别从命令窗口运行相同的命令时,它会按预期正常执行。

Dav*_*d R 6

更换&;这样的。

set DEBUG=app;node app.js
Run Code Online (Sandbox Code Playgroud)

VSCode用途Powershell作为其终端,而在Powershell命令分隔符是;NOT&

在此处查看 MSDN 博客

希望这可以帮助!