Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

schedule a task to run before the pc shut down 1

Status
Not open for further replies.

davikokar

Technical User
May 13, 2004
523
IT
Hallo,

I have a task that I have to run everyday (it is a synchronization tasks). This task takes a long time (10-20minutes). I would like to run this task and then to shut down the PC. But I don't want to wait so long before I can shut down. So the question is: is it possible to automate the shutdown after I run a specific task?
 
Sure. There are a lot of options, but the way I would do it is to create a new scheduled task that uses shutdown.exe. You would want to edit the Run field to look something like this:

[tab]c:\WINDOWS\system32\shutdown.exe -s -f -t 30

Then all you have to do is schedule the time. You can look up what each switch means, but just in case a process hangs I always include the -f switch to force it.

~cdogg
"Insanity: doing the same thing over and over again and expecting different results." - Einstein
[tab][navy]For posting policies, click [/navy]here.
 
The fact is that the scheduler of WinXP asks me at what time I want to run the task. But I don't want the task to run at a specific time (because I finish working at different time), I want the task to run when I shutdown the machine (obvously the task should end, and then the machine would shut down).

In other words, I would like something like this:

I click the shutdown button, windows asks me if I want to run my task, I say yes run the task, the task run, (I can go away), and finally the pc shuts down.

 
Can't you just schedule the computer to shutdown at a later time, say a couple hours after you know you'll definitely be out of the office?

For example, I know that sometimes I'll work as late as 6pm during the week but most of the time I'm out of the office by 5pm. If I had a 30 minute task to run at the end of every day, then I would probably schedule my PC to shutdown around 8pm every night which gives me plenty of buffer. Then all I have to do at the end of the day is kick off the task, because I know that the shutdown sequence would eventually kick in.

Wouldn't something like that work for you?

~cdogg
"Insanity: doing the same thing over and over again and expecting different results." - Einstein
[tab][navy]For posting policies, click [/navy]here.
 
in my case this is not a solution because I dont really have fixed times. It can be 12pm or 12am...
 
ok, this looks pretty much like a solution.

very thanks
 
Scripting it is definitely the way to go (good suggestion), but I must also point out that it only takes about 10 seconds to modify the time a task is scheduled to run, which is a hundred times better than what you've been doing up until this point (waiting 10-20 min). Still it's another step and not as efficient, I must admit.

Glad you found what you were looking for...
 
I've used AMP WinOff in the past. It gives you a lot of options during shutdown, including setting a timer. Like I said before, there are a lot of options out there!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top