Home NT Commands
NT Syntax

CLEANMGR.exe

Automated cleanup of Temp files, Internet files, downloaded files, recycle bin (XP).

syntax
     CLEANMGR option

options
       /d driveletter: - Select the drive that you want Disk Cleanup to clean.

       /sageset:n      - Display the Disk Cleanup Settings dialog box and create
                         a registry key to store the settings you select.
                         The n value is stored in the registry and allows you to
                         specify different tasks for Disk Cleanup to run.
                         n can be any integer from 0 to 65535.
                         Specify the %systemroot% drive to see all the available options.

      /sagerun:n       - Run task 'n'
                         All drives in the computer will be enumerated, and the
                         selected profile will be run against each drive. 

Only one of the 3 options above can be run at a time
e.g.
The command
      CLEANMGR /sageset:64
Will save a group of settings

The command
      CLEANMGR /sagerun:64
will run Disk Cleanup using the settings previously defined.

Options that can be chosen for cleanup:

Temporary Internet Files
Temporary Setup Files
Downloaded Program Files
Old Chkdsk Files
Recycle Bin
Temporary Files
Temporary Offline Files
Offline Files
Compress Old Files
Catalog Files for the Content Indexer

Items in bold may appear in more than one drive i.e not just in %SystemRoot%

 

Other items you may want to clear out or delete...

Recent files

To clear the shortcuts for My Recent Documents (Start, Documents)

cd %userprofile%\Recent
echo y| del *.*

Notice that the 'Recent' folder may contain many more shortcuts than are set to display under Start, Documents.

Locked files (Typically IE temp files or the Offline cache)
This works on any version of NT, 2000 or XP

Close all applications
Open a command prompt
Click Start, and then Shut Down
Simultaneously press CTRL+SHIFT+ALT.
While you keep these keys pressed, click Cancel in the Shut Down Windows dialog box.
In the command prompt window, navigate to the cache location, and delete all files from the folder (DEL /s)
At the command prompt, type explorer, and then press ENTER.


"Then will I sprinkle clean water upon you, and ye shall be clean: from all your filthiness, and from all your idols, will I cleanse you." - Ezekiel 36:25

Related commands:

DELPROF - Delete NT user profiles and/or User Profile cache
DEFRAG - Defragment hard drive (XP)
Q253597 - CleanMgr - Automated cleanup of Temp files, Internet files etc.
Q812248 - Disk Cleanup stops responding while compressing old files

Equivalent Linux BASH commands:

watch - Execute/display a program periodically



Simon Sheppard
SS64.com