On Linux, I can do:
$ FOO=BAR ./myscript
to call "myscript" with the environment variable FOO being set.
Is something similar possible in PowerShell, i.e. without having to first set the variable, call the command, and then unset the variable again?
To be more clear about my use case - I don't want to use this as part of a script. Rather, I have a third-party script whose behavior I can control using environment variables, but, in this case, not command line arguments. So being able to alternate between typing
$ OPTION=1 ./myscript
and
$ ./myscript
would just be very handy.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…