Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expand a variable as several space separated program arguments

Tags:

powershell

Dears,

I have an environment variable containing all the arguments to pass to a program. VAR_NAME=/arg1 /arg2 /arg3 ...

I tried invoking the program using:

program $Env.VAR_NAME

Unfortunately the environment variable expends to a single argument.

Thanks.

like image 816
Baylej Avatar asked Oct 15 '25 04:10

Baylej


1 Answers

Just split the environment variable to return a list of arguments:

program ($Env.VAR_NAME -split ' ')
like image 69
Martin Brandl Avatar answered Oct 18 '25 13:10

Martin Brandl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!