Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to schedule a task to run when shutting down windows

How do you schedule a task in Windows XP to run when you shutdown windows. Such that I want to run a simple command line program I wrote in c# everytime I shut down windows. There doesn't seem to be an option in scheduled tasks to perform this task when my computer shuts down.

like image 405
Crippeoblade Avatar asked Sep 19 '08 13:09

Crippeoblade


People also ask

How do I schedule a task when Windows is shutting down?

Open Start, Search for Task Scheduler, and press enter to open Task Scheduler. Click on the "Create Basic Task" option. Provide the Task Name such as Shutdown and click next. Choose when would you like your task to start and click next.

Does Task Scheduler work when computer is shut down?

No, it won't execute.

Can I schedule a time for my PC to turn off?

To create a shutdown timer manually, open Command Prompt and type the command shutdown -s -t XXXX. The "XXXX" should be the time in seconds you want to elapse before the computer shuts down. For instance, if you want the computer to shut down in 2 hours, the command should look like shutdown -s -t 7200.

How do I run a program before Windows shut down?

To do this, go to your local group policy editor (Click Start, type gpedit. msc in the Start Search box, and then press ENTER.) Within here, you can choose to select scripts which will run on your machine as part of startup/shutdown.


1 Answers

Execute gpedit.msc (local Policies)

Computer Configuration -> Windows settings -> Scripts -> Shutdown -> Properties -> Add

like image 54
Dan Williams Avatar answered Sep 19 '22 12:09

Dan Williams