Stop currently running Windows screensaver from command line
Solution 1
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
Solution 2
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.
Solution 3
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
Related videos on Youtube
Peter Bridger
Lead Developer at Sparkol (www.sparkol.com) instiling the benefits of TDD and SOLID within the teams I run and using Scrum and a Continuous Delivery pipeline to continuously deliver high quality software
Updated on September 18, 2022Comments
-
Peter Bridger almost 2 years
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?
-
matan129 almost 11 yearsJust clear this to me. The new screensaver won't show up because there is already one running?
-
gronostaj almost 11 yearsWhat about "pressing spacebar" programmatically?
-
Werner Henze almost 11 yearsWhat are these tasks? Programs programmed by you?
-
Peter Bridger almost 11 yearsYes, they're written by me
-
-
Peter Bridger almost 11 yearsUnfortunately the simulated mouse approach didn't work :(
-
Werner Henze almost 11 yearsDefinitely not elegant, especially if the tasks are programs written by yourself.