Skip to main content

Shutdown your PC using C program.

Hi guys all of we know how to shutdown the PC using batch file or by normal method.But have you ever tried to shutdown your PC using C program.If not in this tutorial i am gonna teach you how to shutdown your  PC by writing a simple c program.so lets see how to do this.
Shutdown your PC using C program.

Steps:

1.Open any c program compiler and copy the below code.

Code to shutdown the PC:

For windows 7:

#include <stdio.h>
#include <stdlib.h>
#include<conio.h>//optional
main()
{
   char ch;
   printf("Do you want to shutdown your system yes or no\n");
   scanf("%c",&ch);
   if (ch == 'Y' || ch == 'y')
      system("C:\\WINDOWS\\System32\\shutdown /s");// s-shutdown r-restart l-logoff h-hibernate
  getch();//you can use return 0; instead of getch();
 
}
Note: 
  • S-Shutdown.
  • r-Restart.
  • l-Log off.
  • h-Hibernate.
It takes 30 seconds to shutdown,But if you want to shutdown immediately use shutdown /s/t 0 instead of shutdown /s in windows 7.Here /t 0 means shutdown after zero seconds.

For windows XP:

#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
main()
{
   char ch;
   clrscr();
   printf("Do you want to shutdown your system yes or no\n");
   scanf("%c",&ch);
   if (ch == 'Y' || ch == 'y')
      system("C:\\WINDOWS\\System32\\shutdown -s");// s-shutdown r-restart l-logoff  h-hibernate   getch();//you can use return 0; instead of getch();   
}
2.Finish. 
That's it friends i hope you enjoyed the article and if you have any ideas or any queries regaridng any topic feel free to ask us through comments and have a nice day.

Comments

Popular posts from this blog

How to make an Installation file(setup file) using Iexpress.

Hi guys welcome to worldtech360. In this tutorial or article I  am going to show you how to create an installation file(setup file) for the .EXE file which you have created using an inbuilt option in windows 7 named ‘ iexpress ’. So let’s see how to do this. Note: You can also create an installation file for .bat file files or .VBS files or any other files which are executable. Steps: 1. Choose an .EXE file or any other file for which you want to create a setup file or installation file. In this I am going to use .VBS file 2. Open Run and type “ iexpress ” or “ iexpress.exe ” and hit enter. 3. After hitting enter, iexpress wizard window will popup. On the screen you will see two options i.e. “ create new self-extracting directive file ” and the other is “ open existing self-extracting directive file ”. I recommend you to choose the first option as you are going to create a self-extracting file and click next. 4. In the next window select “ Extract files on...

How to install Backtrack 5 R3 on Oracle VM virtual box

Hi guys in this tutorial i am gonna show you how to install Backtrack 5r3 using virtual box.This tutorial is only for Educational purpose,Don't try to use it in a wrong way.Before going into the discussion let see what exactly backtrack means?Backtrack is an operating system which is developed especially for hackers and other security professionals.Mostly if we want to hack a wifi password i.e WEP or WPA or if we want to do phishing we need certain tools to do it.But Backtrack reduces this burden as it contains a bag full of hacking software's like gerex,Social engineering tools and many more.So lets install backtrack 5 r3 using virtual box. Steps:  Requirements: Backtrack( CLICK HERE ). Virtualbox( CLICK HERE ). 1.Install the Virtual box and open it. 2.Now we see a screen like below. 3.Click on New button and a window will up asking to type the name,Type and version.Select the type as 'linux' and version as 'oracle' as shown below and hit next...

8 Important Tips to Protect Your Magento Store from Hacking

Protection of eCommerce and financial websites is necessary because these websites deal with monetary transactions and stand first as a victim in the list of cyber crime. Magento is the most popular eCommerce platform which also comes under threat of hacking by accessing unauthorized logins and other attacks. Magento Platform is rich in security features but security is needed on the admin level to protect it from cyber criminals. Here are some security tips that help you to protect your Magento store and keep your site safe: 1.Admin Path Customization: It is the first step you can take to keep your Magento site safe is to customize the admin path because the normal login pages and admin pages can easily be accessed by just hit and trial methods and it is very easy to navigate to admin page by hackers if the path remains unchanged. With the use of many hacking software available online, it is easy to guess user name and password combinations and these software can guess user n...