Implementation Steps
1. Create the Main.bat file
Log in to Windows XP as an administrator and create a new file named Main.bat in the root directory of the system disk. The name can be taken casually, the same below) and enter the following:
cd\\
C:
cd Windows\\system32
defrag C: /f
chkntfs C:
2.Create the Main.inf file
Create a new file named Main.inf and type:
[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
In this file, Signature must be set to "$CHICAGO$" or the file will not work.
3.Create the Begin.bat file
Create the batch file Begin.bat in the root directory of the C drive, and enter it into this file:
C:\\Windows\\ System32\
undll32.exe advpack.dll,LaunchINFSectionEx
C:\\Main.inf,DefaultInstall,,32
The purpose of this command is to let Windows XP start a hardware installation process and execute it. 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. Scheduled Tasks
The role 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 enter the program. →Accessories→System Tools→Scheduled Tasks, double-click Add Scheduled Tasks, click Browse, locate the Begin.bat file under the root directory of the C drive, and click the Next button;
(2) Set the task execution period to "Weekly", and then click the "Next" button;
(3) Set the password for executing the scheduled task, that is, the administrator password of the computer, and then click " Next step button;
(4) Set the specific date and time for executing the task.
In the above example, we let the scheduled task execute the file C:\\Begin.bat at 23:30 every Sunday for automatic maintenance.
Implementation Principles
.inf files are usually used for hardware installation, which is actually 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.
When Main.inf starts, it 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 + power off."
The last thing to note is that this method can only be implemented in Windows XP Professionl, Windows XP Home cannot be used.
In general, when we change the hardware such as the new motherboard, RAID card or IDE card (that is,
Q: My computer starts slower than others, and the slow startup speed of Windows XP is a head
Windows home (www.Windowszj.com): Many friends will not install the system. The system has encounter
Because the Windows XP operating system is the NT kernel operating system, its installation is basic
Some knowledge about safe mode, common sense you must understand
The strongest in history? From 0 to 33600 Logical Port Details (1)
Win XP SP2 system setting trick
Windows XP Optimized Network Part
Make Windows XP multi-system boot menu different
Let XP system also get Vista security features (2)
Add a solid security lock for Windows XP
Make troubles and troubles all over the station - let Win XP update normally
Windows XP shutdown settings let the system reborn
Excellent features in the cloned VISTA system in XP (2)
The empty folder inside the win7 system hard disk can not be deleted how is it?
Win10 Creators preview version 14959 multi-language package official download summary
Virtual Server Implementation Method
Win8.1 system to play old game legends frequently appear flower screen solution
Explain the tempting beauty of virtual Wifi NIC under Windows 7 (1)
Mobile hard disk and U disk installed Windows7 method
Merge two IE8 browser processes under Windows 7 system
No password Win7 directly into the system
How to install fonts in Win8.1 Win8.1 font installation graphic tutorial