Misc notes on npm script issues and solutions in Windows environment
3 Feb. 2026 Chat with Google Search AI (GSAI) [Note: GSAI confirmed that by default, npm scripts on Windows use the Command Prompt (cmd.exe), not PowerShell.] Me: Windows command prompt set env variable and run another command which needs it GSAI: ... 3. Temporary Scoping (Child Shell) To ensure the variable is "forgotten" immediately after the command finishes, run it inside a child shell . Command: cmd /C "set "TEMP_VAR=abc" && run_process.exe" Effect: Once the process finishes and the child shell closes, TEMP_VAR will no longer exist in your main command prompt session. ... Me: Set is great! another ai tool suggested setx. Pls comment GSAI: setx is powerful but comes with a major "gotcha" for your specific use case: it doesn't affect the current session . Here is the breakdown of why you might use it and when you definitely shouldn't: 1. The Big "Gotcha" If you run setx MY_VAR value and ...