On Linux, I can do:
$ FOO=BAR ./myscript
to call \"myscript\" with the environment variable FOO being set.
Is something similar pos
I got motivated enough about this problem that I went ahead and wrote a script for it: with-env.ps1
Usage:
with-env.ps1 FOO=foo BAR=bar your command here
# Supports dot-env files as well
with-env.ps1 .\.env OTHER_ENV=env command here
On the other hand, if you install Gow you can use env.exe which might be a little more robust than the quick script I wrote above.
Usage:
env.exe FOO=foo BAR=bar your command here
# To use it with dot-env files
env.exe $(cat .env | grep.exe -v '^#') SOME_OTHER_ENV=val your command