I need a way to automatic open program after it close

mr spot 21 Reputation points
2022-09-13T10:10:58.78+00:00

Hi,

I don't know if it the right place to ask!!!

but I want a way to open any program .exe after 3 minute when it is closed

Thank you in advance

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 36,291 Reputation points
    2022-09-13T13:27:16.327+00:00

    You can use a Powershell script to watch for a program and restart it when it's not running.

    while ($true) {                     #infinite loop  
        $Procs = Get-Process notepad -ErrorAction SilentlyContinue   # how many are running?  
        if (($procs).Count -eq 0) {   
            "{0} - Notepad is not running" -f (Get-Date)  
            Start-Sleep -Seconds (3 * 60)                  # wait for 3 minutes  
            Start-Process notepad.exe                      # start a new instance   
            "{0} - Notepad was started." -f (Get-Date)  
        }  
        Start-Sleep -Seconds 30                            # delay for a while until we need to check again  
    }  
    

    Beyond that, your question is just too simplistic. You really should provide more details of the overall problem that you are trying to solve.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2022-09-14T05:20:46.527+00:00

    There is no Windows build-in feature for your requirement, even because it don't make any sense.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.