Search code examples
powershellgototaskkill

Powershell problem - i dont know how to make goto


i have an code and i want to do a goto but i dont know how to make it in Powershell

:yea
taskkill /im wordpad.exe /f
(get-process | ? {$_.Description -eq "Notepad"}).kill()
goto yea

i tried to read how to make it in google but i dont understeand anything xd maybe its simple but i dont know how to make it

i read it something of

break and continue

please help me (:Yea and goto yea its when i want the loop)

aa a

a a

a a

a a a

a a a a


Solution

  • Use a while() loop:

    while($true){
      taskkill /im wordpad.exe /f
      (get-process | ? {$_.Description -eq "Notepad"}).kill()
    }