The daily maintenance of Windows XP is a time-consuming and boring thing. If Windows XP is smarter, it's fine to do 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 Steps
1. Create Main.bat file
Log in to Windows XP as an administrator and create a new name called Main.bat in the root directory of the system disk. The file (the file name can be taken casually, the same below) and enter the following:
cd
C:
cd Windowssystem32
defrag C: /f
chkntfs C:
2. Create a 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: WINDOWSSYSTEM32TSSHUTDN.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:WINDOWSSystem32undll32.exe Advpack.dll,LaunchINFSectionEx
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. 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”, find 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
The .inf file is usually used for hardware installation and 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 defragment C: jobs. 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, namely:
C:WINDOWSSYSTEM32TSSHUTDN.EXE 0 /DELAY:0 /POWERDOWN
The purpose of this statement is to turn off the computer, which is actually "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.
Checking and hooking in Word is a basic office skill, especially in the print publishing industry. M
The computer is now powerful and can do a lot of things. Moreover, computer hardware is not expensiv
In the XP system, it is common to see a blue screen. The reason why the computer is on the blue scre
What should I do if the printer prints text in the XP system? I believe that many users have encount
WinXP opens two methods of screen keyboard
Ten repair methods to eliminate hidden dangers in one step (3)
XP local connection disappeared how to solve?
The five major computer optimization tools let you choose
How to solve the abnormal memory? Counting several memory failures
New Year's New Weather Win XP, play the mouse with new tricks
Adjust hardware factors Speed up windows xp startup speed
Ten repair methods to eliminate hidden dangers in one step (1)
Recovery WinXP administrator password five big tricks
What should I do if the Insider setting item is not available in Win10 RS2 Preview 14905?
How to put the program icon of the Win8 start screen on the desktop
Mysql service can't start 1067 error resolution
Win7 system folder properties hidden options display gray can not be changed how to do
Win7 system to view the computer IP in the same LAN