Automatically maintain Windows XP Pro another way

  
        Maintaining Windows XP Pro is a different approach

The daily maintenance of Windows XP is a time-consuming and boring thing. If Windows XP can be smarter, it is good to perform automatic maintenance. Below, we will introduce a technique for automatic maintenance of Windows XP through .inf file. The specific content of automatic maintenance can be set arbitrarily, but it needs to be implemented by commands. For example, use Xcopy for file backup, Defrag for disk defragmentation, Del to delete junk files, and so on. In order to clarify the principle, let's take Defrag as an example. You can modify it according to your needs.

Implementation step
1. Establish Main. Bat file
Log in to Windows XP as an administrator. Create a new file named Main.bat in the root directory of the system disk (the file name can be taken randomly, the same below) and enter the following content:

Cd
C:

cd Windows\\system32

defrag C: /f

chkntfs C:

2. Establish Main. Inf file
Create a new file named Main.inf and enter:

[version]

Signature= "$CHICAGO$"

AdvancedINF= 2.5, "advpack.dll"

[DefaultInstall]

RunPreSetupCommands=Tst.PreSetup

RunPostSetupCommands=Tst.PostSetup

[Tst.PreSetup]

C:\\Main.bat

[Tst.PostSetup]

C:\\Windows\\SYSTEM32\\TSSHUTDN.EXE 0 /DELAY:0 /POWERDOWN

At In this file, Signature must be set to "$CHICAGO$" or the file will not work.
3. Create Begin. The bat file
creates a batch file Begin.bat in the root directory of the C drive. Enter:

C:\\Windows\\System32\ undll32.exe advpack.dll,LaunchINFSectionEx
< BR>C:\\Main.inf,DefaultInstall,,32

The purpose of this command is to let Windows XP start a hardware installation process to execute the instructions in the .inf file. Rundll32.exe is used in Windows to call functions provided by functions in DLL files (dynamic link libraries). For example, the rundll32.exe here calls the LaunchINFSectionEx function in advpack.dll. The function of this function is to start an .inf installation process. However, the content of Main.inf has not been related to hardware installation, but has been changed to a system automatic maintenance command by us.

4. The task of the scheduled task
is to periodically execute the Begin.bat file. The steps are as follows:

(1) Open the Windows XP Start menu and go to “Programs→Accessories→System Tools→Scheduled Tasks” and double click "Add Scheduled task", click "Browse" to find the root directory of C below Begin.bat file, and then click "Next" button;

(2) set the task execution cycle "weekly "and then click" Next "button; password

(3) is set to perform a scheduled task, that is the administrator password for the computer, then click the" Next "button;

(4) Set the specific date and time for executing the task.

In the above example, we plan to make this task 23:30 every Sunday to perform a file C: \\ Begin.bat, automatic maintenance.

The principle
.inf files are usually used for hardware installation, in fact, it is a text file. When the user right-clicks on the file and selects "Install", Windows will perform a series of operations based on the contents of this file. The automatic maintenance method described above is implemented by means of this feature of the .inf file.

When we create a scheduled task, it will call Begin.bat. Begin.bat will use Main.inf as a configuration file to start an installation process and perform a series of operations in accordance with the contents of Main.inf.

Main.inf will first execute the statement in the [Tst.PreSetup] section, which is called "C:\\Main.bat". When Main.bat is called, Windows will perform disk fragmentation on C: Organize your work. The richer the content of Main.bat, the more powerful the automatic maintenance function.

After the commands in Main.bat are executed, the statements in [Trs.PostSetup] will be executed again, that is:

C:\\Windows\\SYSTEM32\\TSSHUTDN.EXE 0 /DELAY:0 /POWERDOWN

The purpose of this statement is to turn off the computer, in fact, "turn off Windows XP + turn off the power." That this method

final note can only be achieved in Windows XP Professionl in, Windows XP Home can not
Copyright © Windows knowledge All Rights Reserved