powershell - How do I tell my script to go back to a certain point of the script? -



powershell - How do I tell my script to go back to a certain point of the script? -

here script far:

$booktitle = read-host "enter book title" if ($booktitle -eq "") { [system.media.systemsounds]::beep.play(); write-host "please come in book title" } else { write-host "" ; write-host "book title is: $booktitle" }

what want if user enters book title null, want script execute error code block:

{ [system.media.systemsounds]::beep.play(); write-host "please come in book title" }

and jump origin of particular segment:

$booktitle = read-host "enter book title"

instead of continuing on rest of script. don't want jump origin of entire script because plan on using kind of logic within script.

i'm not sure how it. i've tried using loops instead do...while, do...until, while, maintain getting infinite loops.

so question is, doing wrong? should using loops instead of conditional statements? mixture of both?

do { $booktitle = read-host "enter booktitle.." [system.media.systemsounds]::beep.play(); } while ($booktitle -eq "") $booktitle

powershell

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -