So I have scheduled a task to run some script at windows shutdown through task scheduler, the trigger is an event its source is USER32 its ID is 1074. I have made some shortcut placed on my desktop to shutdown my computer its code is:
shutdown /s
the problem is whenever I try to shutdown my computer using this shortcut the scheduled script run as expected. But whenever I try to shutdown using the normal way (start > shutdown), the scheduled script doesn't run as expected. when viewing event log the case of the shortcut its says EXPLORER.exe initiated a shutdown, the case of the normal method says C:\Windows\system32\shutdown.exe initiated a shutdown. I don't know why the script doesn't run as expected when I shutdown using the normal way. Ps: the scheduled scripts does copy the estimated charge remaining in the battery and shutdown time to some text file placed in my desktop.
shutdown /s /f /t 0
or simplyshutdown /s /t 0
instead of the command your using. You might want to force the shutdown, this will close any open applications forcefully, so I suggest you test without it. Proper research is the key to solving any problem.shutdown
to shutdown a system that is already shutting down. You’ll just be told the system is already shutting down. You do understand that using a trigger based on the system shutting down to run theshutdown
command really makes no sense, right? What are you REALLY trying to accomplish here?