Author Posts

May 14, 2015 at 11:08 pm

Hi,
Likewise

PS C:\> 1..60 

The above sort of input gives 1 to 60 automatically, I want to define my own specified data to auto range.

For Example if I can define the data like below,
'data1','data2','data3','data4','data5','data6','data7','data8','data9' ,'data10'

The above data should come when I say...

PS C:\> data1..data10

May 14, 2015 at 11:31 pm

The range operator only works with numbers – in fact integers apparently

If you want to define other things you'll need to code it

$data = 'data1','data2','data3','data4','data5','data6','data7','data8','data9' ,'data10'
$data[0..9]

or

$data[2..5]

or

0..9 | foreach {"$($data[$psitem])plusmore"}