Let's say i have this code:
$test = @("apple" , "orange", "pear")
If i do write-host $test[0]
i will get apple
returned.
If i do write-host $test[0] $test[1] $test[2]
i will get this returned:
apple
orange
pear
When i try getting in 1 line as just a single string I am doing:
write-host "$test[0] $test[1] $test[2]"
But this returns:
apple orange pear[0] apple orange pear[1] apple orange pear[2]
It can't seem to recognise the index now that i Have added quotations
Question:
Anyone know how i can just get my result to look like:
"apple orange pear"
Note: i do need to wrap this in quotations as i will be using it a script elsewhere which would require this - this is just a simple example for what i need