I have a number of Scheduled Tasks running on a Windows machine, which is design to run stand alone and show useful information to the office.

Part of it's use is to run a screensaver that itself shows useful information.

There are some scheduled tasks which need to display information to the screen, however as the screensaver is running these messages can't be seen until the screensaver it manually deactivated.

How can the currently running screensaver in Windows be deactivated from command script?

  • 1
    Just clear this to me. The new screensaver won't show up because there is already one running? – matan129 Jul 2 '13 at 11:01
  • What about "pressing spacebar" programmatically? – gronostaj Jul 2 '13 at 11:47
  • What are these tasks? Programs programmed by you? – Werner Henze Jul 8 '13 at 8:48
  • Yes, they're written by me – Peter Bridger Jul 9 '13 at 12:49

You can do this using PowerShell to move the mouse a pixel, deactivating the screensaver.

$Pos = [System.Windows.Forms.Cursor]::Position
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point((($Pos.X) + 1) , $Pos.Y)

You can also try a 3rd party program, such as AutoIt, which allows you to script mouse movements.

  • Unfortunately the simulated mouse approach didn't work :( – Peter Bridger Jul 8 '13 at 8:29

The correct syntax would be:

taskkill /im PhotoScreensaver.scr /f

With of course the correct name of the running screensaver, which in my case is PhotoScreensaver.scr


I had a eureka moment, I was making the approach too complex. All that's needed is:

kill -processname XXXX

Where XXXX is the name of the screensaver process

  • Definitely not elegant, especially if the tasks are programs written by yourself. – Werner Henze Jul 8 '13 at 15:56

I found a nice way of doing this here. This moves the cursor to position 0,0 which on my Windows 10 system brings the computer out of the screensaver. Works great in a batch file.

rundll32 user32.dll,SetCursorPos

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.