#include "stdio.h"
#include "stdlib.h"
#include "windows.h"
int main()
{
char i[100],j[100];
char choose=0;
system("color A");
while(1)
{system("cls");
printf("请问是否创建自动关机任务(Y/N):");
scanf("%c",&choose);
if(choose=='Y'||choose=='y'){
printf("请输入关闭时间(hh:mm):");
scanf("%s",i);
sprintf(j,"schtasks /create /tn \"关机\" /tr \"shutdown /s\" /sc once /st %s",i);
system(j);
break;
}
else if(choose=='N'||choose=='n')
{
system("schtasks /delete /tn \"关机\"");break;
}
else
printf("false");
}
system("pause");
#if(0)
char i[100];
int j=10;
printf("请输入关机时间:");
scanf("%d",&j);
while(1){
system("cls");
if(j>0){
printf("关闭电脑时间:%d s",j);
Sleep(1000);
j--;
}
else{
system("shutdown/s");
printf("准备关闭电脑\n");
system("pause");
}
}
#endif
}