Daily maintenance of Windows XP is a time-consuming and boring task. If Windows XP is smarter, it would be nice to perform automatic maintenance. Next, we will introduce you to the technique of enabling Windows XP to perform automatic maintenance through the. inf file. The specific content of automatic maintenance can be set at will, but it needs commands. For example, Xcopy is used for file backup, Defrag is used for disk fragmentation, and Del is used to delete junk files. In order to clarify the principle, we will take Defrag as an example. You can modify it as needed.
Steps
1. Create the Main. bat file
Log on to Windows XP as an administrator, create a file named Main. bat under the root directory of the system disk (the file name can be obtained at will, the same below), and enter the following content:
Cd
C:
Cd Windowssystem32
Defrag C:/f
Chkntfs C:
2. Create the Main. inf file
Create a file named Main. inf and enter:
[Version]
Signature = "$ CHICAGO $"
AdvancedINF = 2.5, "advpack. dll"
[Defainstall install]
RunPreSetupCommands = Tst. PreSetup
RunPostSetupCommands = Tst. PostSetup
[Tst. PreSetup]
C: Main. bat
[Tst. PostSetup]
C: WINDOWSSYSTEM32TSSHUTDN. EXE 0/DELAY: 0/POWERDOWN
In this file, Signature must be set to "$ CHICAGO $", otherwise the file will not work.
3. Create the Begin. bat file
Create a batch processing file Begin. bat under the C-drive root directory, and enter:
C: WINDOWSSystem32rundll32.exe advpack. dll, LaunchINFSectionEx
C: Main. inf, DefaultInstall, 32
This command enables Windows XP to start a hardware Installation Process and execute commands in the. inf file. Rundll32.exe is used to call functions provided by DLL files (Dynamic Link Library) in Windows. For example, rundll32.exe calls the LaunchINFSectionEx function in advpack. dll to start a. inf installation process. However, the content of Main. inf has nothing to do with hardware installation. Instead, we steal the bar and change it to the command automatically maintained by the system.
4. Schedule Tasks
Scheduled tasks are used to regularly execute the Begin. bat file. The implementation steps are as follows:
(1) Open the Start Menu of Windows XP and go to "program> attachment> System Tools> scheduled tasks". Double-click "add scheduled task" and click "Browse ", find Begin under the C drive root directory. bat file, and then click the "Next" button;
(2) set the task execution cycle to "Weekly" and click "Next;
(3) set the password of the execution plan task, that is, the administrator password of the computer, and then click "Next;
(4) set the task execution date and time.
In the above example, we have this scheduled task execute file C: Begin. bat every Sunday for automatic maintenance.
Implementation Principle
The. inf file is usually used for hardware installation. It is actually a text file. When you right-click a file and select "Install", Windows performs a series of operations based on the content of the file. inf file.
When a scheduled task is started, it calls Begin. bat. Begin. bat will use Main. inf as the configuration file to start an installation process and perform a series of operations according to the content in Main. inf.
Main. when inf is started, [Tst. the statement in the PreSetup] section, that is, "C: Main. bat ", Main. when bat is called, Windows will perform disk fragmentation on C. The richer the content of Main. bat, the more powerful the automatic maintenance function is.
After all the commands in Main. bat are executed, the statements in [Trs. PostSetup] will be executed again, that is:
C: WINDOWSSYSTEM32TSSHUTDN. EXE 0/DELAY: 0/POWERDOWN
This statement is used to shut down the computer. In fact, it is used to "Turn off Windows XP + power off ".
Note that this method can only be implemented in Windows XP Professionl, and Windows XP Home cannot be used.
Daily maintenance of Windows XP is a time-consuming and boring task. If Windows XP is smarter, it would be nice to perform automatic maintenance. Next, we will introduce you to the technique of enabling Windows XP to perform automatic maintenance through the. inf file. The specific content of automatic maintenance can be set at will, but it needs commands. For example, Xcopy is used for file backup, Defrag is used for disk fragmentation, and Del is used to delete junk files. In order to clarify the principle, we will take Defrag as an example. You can modify it as needed.
Steps
1. Create the Main. bat file
Log on to Windows XP as an administrator, create a file named Main. bat under the root directory of the system disk (the file name can be obtained at will, the same below), and enter the following content:
Cd
C:
Cd Windowssystem32
Defrag C:/f
Chkntfs C:
2. Create the Main. inf file
Create a file named Main. inf and enter:
[Version]
Signature = "$ CHICAGO $"
AdvancedINF = 2.5, "advpack. dll"
[Defainstall install]
RunPreSetupCommands = Tst. PreSetup
RunPostSetupCommands = Tst. PostSetup
[Tst. PreSetup]
C: Main. bat
[Tst. PostSetup]
C: WINDOWSSYSTEM32TSSHUTDN. EXE 0/DELAY: 0/POWERDOWN
In this file, Signature must be set to "$ CHICAGO $", otherwise the file will not work.
3. Create the Begin. bat file
Create a batch processing file Begin. bat under the C-drive root directory, and enter:
C: WINDOWSSystem32rundll32.exe advpack. dll, LaunchINFSectionEx
C: Main. inf, DefaultInstall, 32
This command enables Windows XP to start a hardware Installation Process and execute commands in the. inf file. Rundll32.exe is used to call functions provided by DLL files (Dynamic Link Library) in Windows. For example, rundll32.exe calls the LaunchINFSectionEx function in advpack. dll to start a. inf installation process. However, the content of Main. inf has nothing to do with hardware installation. Instead, we steal the bar and change it to the command automatically maintained by the system.
4. Schedule Tasks
Scheduled tasks are used to regularly execute the Begin. bat file. The implementation steps are as follows:
(1) Open the Start Menu of Windows XP and go to "program> attachment> System Tools> scheduled tasks". Double-click "add scheduled task" and click "Browse ", find Begin under the C drive root directory. bat file, and then click the "Next" button;
(2) set the task execution cycle to "Weekly" and click "Next;
(3) set the password of the execution plan task, that is, the administrator password of the computer, and then click "Next;
(4) set the task execution date and time.
In the above example, we have this scheduled task execute file C: Begin. bat every Sunday for automatic maintenance.
Implementation Principle
The. inf file is usually used for hardware installation. It is actually a text file. When you right-click a file and select "Install", Windows performs a series of operations based on the content of the file. inf file.
When a scheduled task is started, it calls Begin. bat. Begin. bat will use Main. inf as the configuration file to start an installation process and perform a series of operations according to the content in Main. inf.
Main. when inf is started, [Tst. the statement in the PreSetup] section, that is, "C: Main. bat ", Main. when bat is called, Windows will perform disk fragmentation on C. The richer the content of Main. bat, the more powerful the automatic maintenance function is.
After all the commands in Main. bat are executed, the statements in [Trs. PostSetup] will be executed again, that is:
C: WINDOWSSYSTEM32TSSHUTDN. EXE 0/DELAY: 0/POWERDOWN
This statement is used to shut down the computer. In fact, it is used to "Turn off Windows XP + power off ".
Note that this method can only be implemented in Windows XP Professionl, and Windows XP Home cannot be used.