0

I need to turn off my system after it reach a certain amount of daily uptime.

I was planning nof writing a batch or a simple program, schedule his boot only for a specific user, that checks the daily uptime of the pc (resetting at 24:00) and do a safe shutdown as soon as the uptime reaches 2 hours a day.

Is there a specifc command line or similar that checks daily uptime? Or that checks daily uptime per user?

I'm running win. 10.

Thank You!

1

1 Answer 1

4

The command shutdown can be given a time parameter.

shutdown -s -f -t 7200 

This would forcefully shut down the computer after 2 hours. It is possible to abort the task using shutdown -a though. Placing this in a batch file, and placing that batch file in the start menu, startup folder will run this every time this user logs on.

If aborting the shutdown becomes an issue, it is possible to accomplish the same using Task Scheduler.

Create a new task. For event, select At log on, choose Specific user, and select his user.

Below, check Delay task for, and change it to 2 hours. (you will have to manually type it in, but it will work) Press ok.

In the Event tab, press new, and select program from the dropdown list. Below at program choose: shutdown Below that at parameters, specify: -s -f -t 0

Press ok twice.

The task has been made and whenever this user logs in, after 2 hours, without any warning, the computer will be turned off. Any unsafed items will be gone. Unfortunately this is not something you want to change, because otherwise at shutdown it will allow the user to cancel the shutdown and continue to work normally.

In theory, you could copy the task, delay the 2nd for 130 minutes, and use these settings, and alter the first one and remove the -f option. That will first shutdown but allow the user to cancel in case any documents are open. If they continue to work, at 2 hours and 10 minutes, the pc is shutdown forcefully and they lose any work they had open.

2
  • Thank you for your answer, but this way does not prevent the user to turn on pc again in the same day and keep on using it, which is the thinkg I need in that particular case.
    – AlCi
    Commented Jun 2, 2016 at 12:25
  • Your post did not specify that you needed that. What you want requires parenthal control with on and off time. Otherwise it is not possible/too complex.
    – LPChip
    Commented Jun 2, 2016 at 12:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .