Vista system cleanup junk files skills

  
        Many friends in Windows XP are using "Shutdown Script + One-Click Batch Processing" to automatically clean up junk files, but this trick is not working under Vista. Although the batch command can still be executed, it finds that many junk files are not available. Was cleaned up. What is the reason for this? How to automatically clean up junk files under Vista? This article will solve these problems for everyone. First, why the garbage removal command fails under Vista. The batch processing command for automatic garbage removal is believed by many friends. In fact, it is a collection of a lot of delete commands. You can also download it from http://www.shudoo.com/bzsoft. A batch file that automatically deletes garbage. Since Vista uses NTFS format partitions, the deletion of files (especially files in the system directory) requires permission to complete. Since many commands in the batch script are to delete files in the system directory (such as the "del /f /s /q %systemdrive%*.log" command, try to delete "C:\\Windows\\SoftwareDistribution\\DataStore\\Logs\\ When edb.log", the system will give a hint to deny access, because the permissions are insufficient. Reminder: Many junk file cleaning scripts on the Internet may not be suitable for everyone, because it is also possible to delete important files by mistake. You should understand the role of the script before using it. Because for security reasons, even if we log in to the system as a system administrator in Vista, in practice it is still only the right to have a standard account. The shutdown script is loaded through the command prompt. By default, it runs as a standard user, so some cleanup spam commands cannot complete the deletion of files due to insufficient permissions. Second, how to automatically clean up the garbage under Vista After knowing the cause of the problem, the solution to the problem is of course to increase the permission to run the batch command. If it is to manually clean up the garbage, we just need to save the cleanup script as a BAT file, then right click on it and select "Run as administrator". However, manual execution encounters UAC "blocking." Our goal is to automate the batch command, so we have to bypass UAC to let the command execute automatically. It is certainly not wise to turn off UAC, where you can automate the command with the help of the mission plan. Master Dong Tip: For some important files in the system directory, by default only the built-in SYSTEM and ADMINISTRATOR users have full control. If the file cannot be deleted after "Run as administrator", then the file ownership should be changed to the currently logged in user and the permission set to "Full Control". Ownership and permission settings can be obtained with the system's takeown and cacls commands. For details on how to use the commands, please refer to Windows Help and Support. Step 1: Save the script downloaded online as "clean.bat" and place it in c:\\. Then click Start → All Programs → Accessories → System Tools → Task Scheduler to start the task plan and click Create Basic Task to start the New Task Schedule Wizard. Step 2: According to the prompt of the wizard, create a task named “clean” and select a time in the trigger that cannot be executed, for example, set to 2006-1-1 (so the task will not be automatically executed). ). Select "Startup Program" and click "Browse" to select "c:\\clean.bat". Step 3: After completing, check the “Dialog box for opening this task property when you click Finish” to switch the open dialog box to the “General” tab. Click "Change User and Group" under Security Options, select the system administrator account to run the task, and check "Run with highest privileges" below. This way, once the mission plan is run, it has administrator privileges. Step 4: Start Notepad to create a new batch of processing cl.bat, placed in c:\\, the code is as follows: Rem use the task plan command to start cleaning garbage, /run means running, /tn followed by the task name Schtasks /run /tn clean Step 5 : Click "Start" → "Run", enter "gpedit.msc" to start the "Group Policy Editor". Expand Computer Configuration→Windows Settings/Scripts (Startup/Shutdown), double-click Shut Down in the right pane, click Add in the window that opens, and add c:cl.bat to the shutdown script. In this way, each time the system is shut down, the system will automatically call this batch command to activate the above task plan to clear the garbage. Since we have set the task run to "Run with the highest privilege" (equivalent to the right "Run as administrator", but will not pop up the UAC prompt), this will run the administrator privilege, which can effectively delete the system junk files. . Due to the characteristics of Vista's NTFS partition, some of the original unobstructed operations under Windows XP, if you encounter a failure under Vista, you must see if it is because of operational permissions. The solution to the problem is to improve the operation rights. If you need to automatically increase the permission to run, you can use the task planning method described in the article.
Copyright © Windows knowledge All Rights Reserved