Windows Task Scheduler: Schedule A Task On Shutdown / Restart Event

Опубликовано: 16 Март 2026
на канале: Tiny Tips
440
17

In this video, we have demonstrated how to schedule a task using Windows Task Scheduler on a Shutdown or Restart event. We can run a program or a script during these events. We have taken the example of removing a directory when the user shuts down or restarts the system. We have covered this using two methods. The first method is by using a batch script file. In this way, the task executes the batch script when the event is triggered. All the commands in the batch script are executed. In this way, we can carry out a wide range of actions. The second method is by executing a program. In our example, we are executing a command prompt when the event is triggered and that command prompt will then execute the remove directory command. Removing the directory is just a simple demonstration. Instead of removing the directory, we can remove a file. Or, We can do something else.

I hope this video proves to be informative. Thank you.

Commands used in the video:
rmdir /s /q "path-to-directory"
cmd.exe
/c rmdir /s /q "path-to-directory"