![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | BREAK out of a LOOP Is there a way to BREAK out of a LOOP? How about CONTINUE/NEXT? Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: BREAK out of a LOOP yes, BREAK is the command "Sue & Bill" <sue.and.bill@xxxxxx> wrote in message news:999087fa-536c-48a2-879c-d3edab5fe6de@xxxxxx Quote: > Is there a way to BREAK out of a LOOP? How about CONTINUE/NEXT? > > Thanks. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: BREAK out of a LOOP see get-help about_break get-help about_continue for details -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "IT Staff" wrote: Quote: > yes, BREAK is the command > > "Sue & Bill" <sue.and.bill@xxxxxx> wrote in message > news:999087fa-536c-48a2-879c-d3edab5fe6de@xxxxxx Quote: > > Is there a way to BREAK out of a LOOP? How about CONTINUE/NEXT? > > > > Thanks. > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: BREAK out of a LOOP In their articles to prepare the 2008 Winter Scripting Games, "The Scripting Guys" explain how to exit a loop in PowerShell (in Perl, and vbscript too). The link: http://www.microsoft.com/technet/scr...p0111.mspx#ERD As mentioned in the article, PowerShell also enables to attach a label to a loop :OutsideLoop for ($y = 1; $y -le 5; $y++) { write-host "Loop number $y" for ($i = 1; $i -le 3 ; $i++) { if ($y -eq 2) {break OutsideLoop} $i } } Regards "RichS" <RichS@xxxxxx> wrote in message news:5DB6AD7E-6E4A-4922-A08F-0E00058A6A45@xxxxxx Quote: > see > > get-help about_break > > get-help about_continue > > for details > -- > Richard Siddaway > Please note that all scripts are supplied "as is" and with no warranty > Blog: http://richardsiddaway.spaces.live.com/ > PowerShell User Group: http://www.get-psuguk.org.uk > > > "IT Staff" wrote: > Quote: >> yes, BREAK is the command >> >> "Sue & Bill" <sue.and.bill@xxxxxx> wrote in message >> news:999087fa-536c-48a2-879c-d3edab5fe6de@xxxxxx Quote: >> > Is there a way to BREAK out of a LOOP? How about CONTINUE/NEXT? >> > >> > Thanks. >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: BREAK out of a LOOP I recommend only using break inside a language contruct look like foreach($a in $b) rather than in foreach-object because if a break happens to escape outside of a language loop, it can BReAK the whole pipeline as it stops the pipelines and causes the cmdlets to get an exception. -Karl |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to break an old raid | Drivers | |||
| Break is not working ? | PowerShell | |||
| Did I break it ? | General Discussion | |||
| Break away | Vista General | |||