I have to execute following command from VS Code Terminal. I am running my application in windows 10 machine.
set DEBUG=app & node app.js
when I run the above command the terminal gives me following error message.
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
However when I run the same command from command window separately it executes fine as expected.
You can always mark your 2 most common commands with isBuildCommand and isTestCommand to run them via cmd + shift + b or cmd + shift + t respectively. This answer has some helpful information that might be useful to you as well.
Once the cursor is in the terminal section you can use ctrl+x ctrl+up or ctrl+x ctrl+down to cycle through the active terminals (note that moving between on-screen split terminals is done with ctrl+x left or ctrl+x right ). cmd-J is still used to hide/show the terminal pane.
Replace &
with ;
like this.
set DEBUG=app;node app.js
VSCode
uses Powershell
as its terminal, And In Powershell
the command separator is ;
NOT &
Checkout MSDN Blog here
Hope this helps!
You can create script in package.json
:
scripts:{
"start": "set DEBUG=app;node app.js"
}
and run with command:
yarn run start // or npm run start (if you use npm)
set
just can use for window, my suggest is use cross-env.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With