Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shutdown PC after finishing a script

I'm runnig a script in R that takes many hours. I woud like that my PC automatically shutdown itself after finish my script. Is that possible? How can I do that using R? I've searched for packages and functions for that, but I couldn't find. Thank you P.S. My PC s running Windows 8.1

like image 684
Tiago Avatar asked Apr 21 '15 02:04

Tiago


People also ask

How do I stop a shutdown script?

From the Start menu, open the Run dialog box or you can Press the "Window + R" key to open the RUN window. Type "shutdown -a" and click on the "OK" button. After clicking on the OK button or pressing the enter key, the auto-shutdown schedule or task will be canceled automatically.


1 Answers

You can call the cmd prompt directly from R

system('shutdown -s')

You can view other shutdown commands here: https://stackoverflow.com/a/162305/1362215. This may be useful if you want to perform other tasks.

like image 196
Max Candocia Avatar answered Sep 26 '22 20:09

Max Candocia