![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | foreach - xml Basically at the moment I've got it appending the out put to a file, Ideally what I would like it to do is to store each of the results in a string. I've tried as many ways as I could think of doing it but I'm stumped.. any help would be appreciated. foreach ($Code in $Securities) { $Quote = [xml]$webclient.DownloadString("http://server:1891/MarketInfoService.asmx/LiveQuote?Code=" + $Code[0]) $Quote.Quote | format-list | Out-File -filepath "d:\test.txt" -Append } |
| | #2 (permalink) | ||||||||||||
| Guest | Re: foreach - xml NeilOz wrote:
$string="" (before your function) .... $string+=$quote.quote (to replace the last line above in your function) Then $string should have the results. You're sure you want a string, and not an array? Array: $array=@() (before your function) .... $array+=$quote.quote (to replace the last line above in your function) Then $array should have the results. Use $array[0] to get the first line. -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com | ||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Export-CSV and foreach | Ryan | PowerShell | 6 | 05-29-2007 06:16 AM |
| foreach, foreach-object & begin/process/end scriptblock clauses... | Clint Bergman | PowerShell | 12 | 05-16-2007 05:30 PM |
| Difference in semantics of for, foreach and foreach-object | Andrew Watt [MVP] | PowerShell | 3 | 01-26-2007 12:46 PM |
| possible bug with using the $foreach keyword inside foreach loops.. | klumsy@gmail.com | PowerShell | 6 | 11-16-2006 06:50 PM |
| RC2 - Bug in help for foreach | Andrew Watt [MVP] | PowerShell | 1 | 09-27-2006 05:22 PM |