Is there a way to make a script jump to a specific spot like :GOTO in command prompt? I wanted to make the script jump to the beginning when it is ended.
$tag1 =
There's no goto in PowerShell, and nobody misses it :). Just wrap the block of commands in a loop or something.
Or try the below. You can assign list of commands to a variable, and then execute them with &$varname
. It's still not goto, though.
$commands = {
Write-Host "do some work"
$again = Read-Host "again?"
if ($again -eq "y"){
&$commands
} else {
Write-Host "end"
}
}
&$commands