0
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.
If you don't provide a time, then 30 seconds is assumed, I am going to guess you don't want any delay. If that is the case then you should be using
– Ramhound – 2017-10-31T20:54:44.627shutdown /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.Exactly!!! and part of that research is asking questions in the right place – TahaEltahawy – 2017-10-31T22:25:53.203
You can’t use
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? – Appleoddity – 2017-11-01T02:22:32.190