#include "iostream"
#include "string.h"
#include "time.h"
using namespace std;
void Hotfix()
{
	int number=1;
	int n=0;
	char str[100];
	char temp[100];
	FILE *fp=NULL;
	fp=fopen("Hotfix.txt","r");
	cout<<"װ벻Ҫرձڣᵼ°װʧ! ! ! \n\nֲڰװпܻᷢ󣬲Ӱİװ!\n\nʼװϵͳ\n\n";
    clock_t first,last;
	double duration;
	while(!feof(fp))
	{
		fscanf(fp,"%s",str);
		n++;
	}
	n--;
	fp=fopen("Hotfix.txt","r");
	first=clock();
	for (;number<=n;number++)
	{
		fscanf(fp,"%s",str);
		cout<<"ڰװ"<<number<<"Ժ󡭡";
		strcpy(temp,"start /wait ");
		strcat(temp,str);
		strcat(temp," /quiet /passive /norestart");
		system(temp);
		cout<<"OK ! ! !\n\n";
	}
	last=clock();
	duration = (double)(last-first)/CLOCKS_PER_SEC;
	fclose(fp);
	cout<<"ϵͳѾȫװ!ܺʱԼΪ"<<(int)(duration+1)<<"!\n\nǷʹЧ?(Y/N):";
	char sure;
	cin>>sure;
	if (sure=='Y'|| sure=='y')
		system("shutdown -r -t 0");
	else
	{
		cout<<"\nѡԺʹЧ!밴˳!\n\n";
		system("pause");
	}

}

void main()
{
	system("color 2e");//Զ崰ڱɫ
	cout<<"\n*************************ϵͳԶװV1.0******************************\n\n";
	cout<<"************************һ*****************************\n\n";
	system("type nul >Hotfix.txt");//ıļ
    int state=system("dir /b /o-d WindowsXP*.exe Windows6.1*.msu KB*.exe >Hotfix.txt");//ļУļдHotfix.txt
	if (state==1)
	{
		system("cls");
		cout<<"\n****************************ϵͳԶװV1.0***************************\n\n";
	    cout<<"***************************һ**************************\n\n";
		cout<<":ڵǰĿ¼ûм⵽ϵͳļ! \n\n뽫򿽱ŲļУȻб!\n\n";
		system("pause");
	}
	else
	{
		cout<<"⵽ǰļϵͳļ,ʼװ!";
		getchar();
		cout<<"\n";
		Hotfix();//ú
	}
}