0

I found the tip to use the wingnu32 tool env from , which is installed on my Windows 10 device anyway, as Git and Docker are installed.

However, I don't get it working as wished. It behaves as follows:

λ env DEBUG=abc echo %programfiles%
C:\Program Files

λ env DEBUG=abc echo %DEBUG%
%DEBUG%

λ env DEBUG=abc
[...]
PROGRAMFILES=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
[...]
WINDIR=C:\Windows
DEBUG=abc

Same behaviour in PowerShell, cmd.exe and cmder... Does anybody know why?

EDIT:

Ok, I found that the problem is due to immediate variable resolution by the shell. This works as expected:

env USER=AB node
> process.env.USER
'AB'

Does anybody know how I can run env with inline commands?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.