preform action on each word separated by commas

I have done this before but I have spent an hour on this and I am just frusterated I should be able to do this.  aggg.

I have a huge list sent to me just like this/

500, 200032 , 700895, 20008787, ECT, ECT

It may be 1000's of numbers.  I need to preform a simple action on each number

I see it is drong.  I have goggled it as I Know this is wrong I cant for the life of me remember what I need to do. 

so ....

$numbers = "500, 200032 , 700895, 20008787, ECT, ECT"


foreach ($number in $numbers) {

"Do something to $number"


}

Please help 
August 31st, 2015 11:07am

$numbers = '1,2,3,4,5'

$numbers -split ',' | ForEach {

    Write-Host "Current number is $_" -ForegroundColor Green

}

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 11:11am

omg thank you

August 31st, 2015 11:20am

Cheers, you're welcome.
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 11:22am

I think you would be a lot less frustrated if you did some tutorials.

Start here:

http://www.google.com/search?&q=learn+windows+powershell

August 31st, 2015 11:31am

Bill i wish there was a way to count a vote as unhelpful.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 7:39am

https://www.google.com/search?q=learn+windows+powershell&safe=active&gws_rd=ssl#safe=active&q=basic+people+skills

Here you go   Bill Stewart 

September 1st, 2015 7:42am

The comment was intended to be helpful.

You mentioned being frustrated. There is no need to be frustrated when there are tutorials out there that help explain PowerShell fundamentals that would help you relieve your frustration.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 10:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics