2

I'm working in a node application that can be started like this from a Mac machine:

DEBUG=app.* ENVIRONMENT=local node server/index.js

However, when trying to run that script in a Windows command line, I get the following message:

" 'DEBUG' is not recognized as an internal or external command, operable program or batch file."

When running the script without the parameters, I don't get any error.

How can I pass said parameters to my index.js from Windows?

1 Answer 1

7

Run this in the CMD window where you'll run your node app.

SET DEBUG=app.*
SET ENVIRONMENT=local
node server/index.js

Or if you want it to be in a single line, type this.

SET DEBUG=app.*&&SET ENVIRONMENT=local&&node server/index.js

To make this variable changes persistent, you should edit your environment variables in control panel.

Sign up to request clarification or add additional context in comments.

2 Comments

Worked like a charm. Thank you.
I know it's a little bit old post, but since I don't want to polute SO, I came here while trying to understand how to pass textual arguments to node... like this : node boot.js -verbose From documentation that should just work. The example only return me value 0 and 1 who are both the path of node and the path of boot.js...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.