How to define auto ranges in powershell


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

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’




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