Is there a way to run a .bat or .cmd when the screensaver starts? I've noticed some .exe can run if you rename them to .scr but is that it?

  • This isn't a direct answer, but, a screen saver stars typically after N amount of idle time. You could use task scheduler to wait for the same amount of time and then launch your program?
    – Dave
    Jan 18, 2013 at 11:45
  • Maybe creating a task in the Task Scheduler with a Trigger of “On workstation lock” would work. Conditions of “Start the task only if the computer is idle” and “Stop if the computer ceases to be idle” might give you what you want. Jan 18, 2013 at 21:12

3 Answers 3


1. Screen Launcher

Screen Launcher lets you choose any program to run as a screensaver. You could start a Powerpoint, a movie or any EXE or associated file. To install, simply unzip, right-click and click Install on the context menu. You can then use Screen Launcher just like any other screensaver. To open files such as Powerpoint presentations, you must execute the powerpoint program and type the path to your ppt as a parameter. An example for displaying an image would be c:\winnt\system32\mspaint.exe c:\picture.bmp. Download today to take advantage of any media as a screensaver.


[Alternate download link since official site seems to be dead.]

2. RunSaver (don't confuse with RunScreenSaver by the same author).

Screensaver that runs a command.


I'm sure there are many more such screensavers that will allow you to launch arbitrary programs/scripts. But what if you'd like to continue using your current screensaver? If so, see below for the solution (tested on Win7, should work fine on Vista+).

3. Using no 3rd party tools

  1. Event ID 4802 corresponds to The screen saver was invoked, but it is not logged by default and thus we need to enable logging for this event first. So open the Local Group Policy Editor (Start / Run / gpedit.msc), navigate to:

    Computer Configuration / Windows Settings / Security Settings / Advanced Audit Policy Configuration / System Audit Policies - Local Group Policy Object / Logon/Logoff / Audit Other Logon/Logoff Events

    and enable the checkboxes for Success and Failure:


  2. If you wait for your screensaver to be launched, you'll now see event logs similar to the following in Event Viewer:


  3. Now it's easy to use Task Scheduler to create a task that will be launched when Event 4802 occurs. Just ensure that the Triggers tab of the task's Properties dialog looks like the following:


  • 3
    You deserve a medal
    – BDM
    Mar 10, 2013 at 0:50
  • @ProfPickle: Thank you for your kind words. :)
    – Karan
    Mar 10, 2013 at 1:16
  • dcmembers.com/skrommel/download/runsave seems like it will probably help me. I got nowhere with Windows Task Scheduler. Thanks!
    – Ryan
    Sep 4, 2023 at 23:50

In order to complete the nice answer from @Karan, I would like to refer, for those interested in executing a program upon screensaver dismissing, that the process is the same used on his "3. Using no 3rd party tools" solution, but Event ID should be 4803.

(For example, in my case I want to disable Aero ("net stop uxsms") when screensaver starts, and reenable it ("net start uxsms") when screensaver stops)


If time is not terribly critical, then you could simply use the Task Scheduler's built-in Trigger "Begin the task: On Idle".

Task Scheduler -> Create Task -> "Trigger" tab -> New -> "Begin the task:" -> "On Idle"

Next, go to the "Actions" tab and set the action to whatever it is you want to run.

This should execute the Action after the screensaver starts (or if the system goes idle without the screensaver), but there may be a 0-15 minute delay. Here is the relevant specifics from the Task Scheduler documentation:

The Task Scheduler service will check if the computer is in an idle state every 15 minutes. A computer is considered to be in an idle state when a screen saver is running. If a screen saver is not running, then the computer is considered to be in an idle state if there is 0% CPU usage and 0% disk input or output for 90% of the past fifteen minutes and if there is no keyboard or mouse input during this period of time.

So, your screensaver launches, and then 0-15 minutes later windows checks for idle and launches your program.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .