Shut down machine after being idle with batch file?

1.1k Views Asked by At

I don't even know if this is possible, but is there anyway to shut down a machine after (n) minutes, using a batch file?

Currently I already have a batch file which works alongside ranorex and a virtual machine, and I need the machine to shut itself down after it has been idle for 10 minutes or so, just to give everything else in the batch file plenty of time to run. Is there any way of doing this?

1

There are 1 best solutions below

0
RoKi0815 On

Just use the command for shutdown and add the option for the time to wait:

shutdown /s /t 600 /f
  • /s is for shutting down the computer
  • /t is for wait before do the operation with time in seconds (10*60=600)
  • /f is for forcefully close all applications

With shutdown /a you can abort the action befor the time runs off. For more options use the help of the shutdown-command.