How to restart your PC using code.

How to restart your PC using code.

Hi guys, so this is my first blog and I hope you like it. Alright, so in this blog I am gonna show you how you can restart your PC through code. It happens with me a lot when my PC gets partially hang and I am not able to click anything in the toolbar to restart, and I know it must have happened to you at some point of time. In that case this tip might be really helpful. Let's get started.

Using Python:

Firstly, go to your code editor and import os and then write the following code:-

Screenshot (8).png

The code in Python might take a while compared to C++.

Using C++:

Go to your code editor and then import stdlib.h library and write the following code:-

Screenshot (6)_LI.jpg

It's really simple , in just two lines of code you can restart your PC. Easy-peasy!.