How to Automatically Restart a Crashed App on Windows 10

To automatically restart a crashed app on Windows 10, use a PowerShell watcher and Task Scheduler. The watcher checks a classic desktop app’s process; when it exits, the script waits 60 seconds and opens it again.

This restarts the app after any exit, including a normal close. It cannot recover unsaved work or fix the reason for a crash. Task Scheduler’s “If the task fails” option retries a failed scheduled task; it does not continuously monitor an app process, so this guide uses a small watcher script.

Before you start

Use this method with a traditional desktop program that has a stable .exe. Microsoft Store apps and programs whose launchers switch to a different helper process may not be tracked reliably. If the app includes its own restart or recovery option, use that instead.

Set up the restart watcher

  1. 1. Find the app’s executable

    From Start, right-click the app shortcut and choose More > Open file location if available. Right-click the shortcut, choose Properties, and copy the path in Target. Use the actual executable, not the .lnk shortcut, updater, or crash reporter.

    File Explorer window showing ExampleApp.exe selected in its Program Files folder.
    Select the program’s main executable file.
  2. 2. Create and save the PowerShell script

    Open Notepad, paste this script, and replace the example path with the one you copied. Keep the path inside the single quotation marks.

    Notepad displaying PowerShell commands for starting, waiting for, and delaying an app process.
    The script checks for the process, waits for it to exit, then tries again after a delay.
    $exe = 'C:\Path\To\ExampleApp.exe'
    $processName = [System.IO.Path]::GetFileNameWithoutExtension($exe)
    $workingDirectory = Split-Path -Path $exe -Parent
    $delaySeconds = 60
    
    while ($true) {
        $process = Get-Process -Name $processName -ErrorAction SilentlyContinue |
            Select-Object -First 1
    
        if (-not $process) {
            try {
                $process = Start-Process -FilePath $exe -WorkingDirectory $workingDirectory -PassThru -ErrorAction Stop
            } catch {
                Start-Sleep -Seconds $delaySeconds
                continue
            }
        }
    
        Wait-Process -Id $process.Id -ErrorAction SilentlyContinue
        Start-Sleep -Seconds $delaySeconds
    }

    Start-Process opens the executable, while Wait-Process waits for it to stop. The delay helps prevent rapid relaunches if the app keeps crashing. See Microsoft’s Start-Process and Wait-Process documentation.

    In Notepad, select File > Save As, choose Documents, name the file Restart-App.ps1, and set Save as type to All Files so Notepad does not add .txt.

    Windows Save As dialog set to save Restart-App.ps1 in Documents with All Files selected.
    Save the script with a .ps1 extension and choose All Files.
  3. 3. Create a task that runs at sign-in

    Search Start for Task Scheduler and open it. Choose Create Task. On the General tab, enter a name such as Restart ExampleApp, then select Run only when user is logged on so the app window opens in your desktop session.

    Task Scheduler General tab with Run only when user is logged on selected for the restart task.
    Keep the task in the signed-in user’s desktop session.

    Open the Triggers tab, choose New, set Begin the task to At log on, select your account if prompted, and click OK. This follows Microsoft’s documented pattern of a logon trigger and executable action in Task Scheduler.

    Task Scheduler trigger tab set to begin at logon for the current Windows user.
    Choose At log on for the account that uses the app.
  4. 4. Configure the action and prevent duplicate watchers

    On Actions, select New and choose Start a program. Enter powershell.exe for Program/script. In Add arguments, use the script path below and change YourName to your Windows user folder:

    -NoProfile -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File "C:\Users\YourName\Documents\Restart-App.ps1"

    RemoteSigned applies to this PowerShell process only; it does not change the computer-wide policy. An organization’s policy may still block scripts. See Microsoft’s guide to PowerShell execution policies.

    Task Scheduler New Action dialog with powershell.exe as the program and Restart-App.ps1 in arguments, beside an app window.
    Run the saved watcher through Windows PowerShell.

    On Settings, set If the task is already running, then the following rule applies to Do not start a new instance. This avoids launching a second watcher if you run the task manually. Click OK to save it.

    Task Scheduler Settings tab with Do not start a new instance selected.
    Allow one copy of the watcher task to run.
  5. 5. Test the restart and stop it when needed

    In Task Scheduler Library, select the task and choose Run. If the app is already open, the watcher waits for it. Save your work, close the app, and wait about a minute; it should reopen. Because every exit triggers a restart, closing it normally is a useful test too.

    Task Scheduler Library showing the restart task selected with Run and Disable buttons next to the app window.
    Run the task to test it, or disable it to stop future automatic restarts.

    To stop the current watcher, right-click the task and select End. Choose Disable to stop it from starting at your next sign-in, or delete the task after disabling it.

Troubleshooting

  • The app does not open: Check both paths and confirm the file ends in .ps1, not .ps1.txt. Run the script in a PowerShell window first to see any error. Do not weaken a work or school policy; ask the administrator.
  • The app opens twice: The process name usually matches the executable name without .exe. If it differs, set $processName to the actual process name. Stop the task before editing the script.
  • The app keeps crashing: Disable the task while you troubleshoot the app. The watcher only relaunches it; it cannot repair missing components or app bugs, restore unsaved documents, or reliably handle Store apps and launchers that hand off to another process.

Leave a Comment

How to Automatically Restart a Crashed App on Windows 10

How to Automatically Restart a Crashed App on Windows 10

Set up a PowerShell watcher and Task Scheduler task to relaunch a Windows 10 desktop app after it closes, then learn how to test and stop it.

How to Show All System Tray Icons on Windows 10

How to Show All System Tray Icons on Windows 10

Keep app icons out of the hidden overflow in Windows 10. Turn on the all-icons option, then manage system icons separately if one is still missing.

How to Update Network Login Credentials in Windows 10

How to Update Network Login Credentials in Windows 10

Change the saved username or password Windows uses for a mapped drive or shared folder through Credential Manager, then reconnect to verify access.

How to Limit Microsoft Defender CPU Usage on Windows 10

How to Limit Microsoft Defender CPU Usage on Windows 10

Set a lower Defender scan CPU target in PowerShell, handle the idle-scan exception, and verify which Windows 10 scans the setting affects.

How to Install a Minecraft Add-On on Windows 10

How to Install a Minecraft Add-On on Windows 10

Import a Bedrock .mcpack or .mcaddon on Windows 10, activate it for a new or existing world, and avoid confusing add-ons with Java mods.

How to Fix “We Can’t Set Up Mobile Hotspot” in Windows 10

How to Fix “We Can’t Set Up Mobile Hotspot” in Windows 10

Restore the Windows 10 hotspot by checking the internet source and wireless adapter, repairing its driver, and saving Network reset for last.

How to Change Screen Brightness by Time of Day on Windows 10

How to Change Screen Brightness by Time of Day on Windows 10

Set daytime and nighttime brightness levels on Windows 10 with ClickMonitorDDC 7.2, and learn about DDC/CI limits and the Night light alternative.

How to Adjust Left/Right Balance for Bluetooth Headphones in Windows 10

How to Adjust Left/Right Balance for Bluetooth Headphones in Windows 10

Find Windows 10’s left/right balance controls for Bluetooth headphones, with a cautious registry workaround when volume controls stay linked.

How to Automatically Shut Down Windows 10 When It’s Idle

How to Automatically Shut Down Windows 10 When It’s Idle

Set up Task Scheduler’s On idle trigger to shut down Windows 10 with a one-minute cancellation window, and learn how Windows defines idle.

How to Burn a Disc Image to an SD Card in Windows 10

How to Burn a Disc Image to an SD Card in Windows 10

Learn how to burn a disc image to an SD card on Windows 10 with balenaEtcher, verify the target drive, and check whether the finished card can boot.