家人们,昨天刚学到的一个关机程序,开始运行因为我代码有点错误,还导致关机了,运行前的激动和运行成功后成就感,真的很刺激,家人们,你值得拥有。
你也可以试试把你运行的可执行程序,设置在朋友的电脑上的服务程序中,并设置属性为自动执行,那么一开机就会被自动设置60内关机,哈哈哈!
关机程序:
//shutdown -s -t 60 (命令关机--设置时间关机)
//shutdown -a (取消关机)
//打开电脑中的cmd
//system执行系统命令
#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS
#include <string.h>
int main()
{
char input[20];
system("shutdown -s -t 60");
again:
while(1)
{printf("请注意,你的电脑将在1分钟内关机,如果输入:我是猪,就取消关机\n");
printf("请输入:>");
scanf("%s",input);
if(strcmp(input,"我是猪")==0)
{system("shutdown -a");
printf("已成功取消关机\n");
break;}
else
goto again;}
return 0;}