Previous Page | Next Page

SAS Disk Cleanup Handler

The SAS Disk Cleanup Handler Utility


The SAS Disk Cleanup Handler searches for and cleans any temporary files that SAS generates, as well as any SAS Work and SAS utility directories. SAS Disk Cleanup Handler is a COM hook into the Microsoft Disk Cleanup Handler (cleanmgr.exe).

SAS Work directories have the format, #TD pid or _TD pid, where #TD is the SAS V6.X prefix and _TD is the SAS V7+ prefix. The pid part of the directory entry is interpreted as the process ID. If the process ID is no longer in use, the SAS Disk Cleanup Handler deletes the entry and the contents of the directory.

SAS Disk Cleanup Handler also removes SAS utility directories that have the following format:



NNNN is a unique random number

PPPPPPPP is the hexadecimal representation of the process ID

nodename is the host name of the machine that created the directory.

SAS Disk Cleanup Handler deletes the utility directories and contents only under the following conditions:

Additionally, you can use the SAS Disk Cleanup Handler to clean SAS automatically generated log files. These log filenames have the format module name.PID.DATE.log. The PID represents the process ID of the process that creates the log file. If the process is no longer running, the log file will be deleted.


The SAS Disk Cleanup Handler requires Microsoft .Net Framework 2.0 or greater for 32-bit Windows, Windows Itanium, and Windows x64 editions.

Using the Disk Cleanup Handler

To run the Disk Cleanup Handler, complete these steps:

  1. Type cleanmgr from the command prompt.

    Note:   You can also start the SAS Disk Cleanup Handler from Windows Explorer. Access My computer and right-click a local physical hard disk. Select Properties and double click Disk Cleanup.  [cautionend]

    Note:   Disk Cleanup Manager will start. This process might take a few minutes.  [cautionend]

  2. Select SAS Temporary Files.

    Note:   If SAS Temporary Files is not listed, the SAS Disk Cleanup Handler is not installed.  [cautionend]

  3. Click View Files to list the currently detected SAS temporary files and directories. If a process is still active, then the file or directory will not be listed. Any files or directories to be saved should be cleared.

  4. Click OK to save changes. Click Cancel to discard.

  5. Click OK in the Disk Cleanup window to start the cleanup.

  6. Check the EventViewer for any errors.

Note:   Windows Server 2008 does not automatically install Microsoft Disk Cleanup Manager (cleanmgr.exe). In order to have Microsoft Disk Cleanup Manager installed as a default application, you must install Desktop Experience. To install Desktop Experience do the following steps:

  1. Open Server Manager.

  2. Select Add Features from the Actions menu.

  3. Select Desktop Experience.


Automating Cleanup with Microsoft Task Scheduler

With cleanmgr.exe you can configure specific tasks to perform the desired cleanups.

To configure Disk Cleanup Manager:

  1. Select Start [arrow] Run.

  2. Type the following text in the Run dialog box: cleanmgr /sageset:n, where n can be any number between 0 and 65535.

  3. Select the items that you want to be cleaned.

  4. Select OK.

    Note:   You can also create a shortcut in your Windows folder to cleanmgr /sagerun:n (where n is the number in step 2). Type a name for the shortcut (for example, cleanuptask).  [cautionend]

  5. If you want to verify the settings, repeat steps 1 through 3.

The following steps apply to Windows XP Professional and Windows Server 2003:

  1. Select Start  [arrow] All Programs [arrow] Accessories  [arrow] System Tools [arrow] Schedule Task.

  2. Add the scheduled task.

  3. Select Next.

  4. Select Disk Cleanup or the shortcut that you created in step 2. If you are using the shortcut, select Next.

  5. Select Next and configure.

    Note:   You must provide your user ID and password to run this task.  [cautionend]

  6. If not using the shortcut, then select the Open advanced properties for this task when you click Finish.

  7. Select Finish when the step is complete.

  8. If you are not using the shortcut, then the Properties dialog box should be displayed. Select the Task tab.

  9. In the Run text box append /sagerun:#, where # is the number from step 2.

  10. Check Event Viewer for any errors under Application.

The following steps apply to Windows Vista and Windows 7.

  1. Select Start [arrow] All Programs [arrow] Accessories  [arrow] System Tools  [arrow] Task Scheduler.

  2. Select Create Basic Task.

  3. Type a name for the task in the Name field.

  4. Select Next.

  5. Select the appropriate triggers and options.

    Note:   Select Next to advance through the trigger options.  [cautionend]

  6. Select Action [arrow] Start Program.

  7. Select Next.

  8. Type cleanmgr in the Program/script: text box.

  9. Type the appropriate arguments for :/sagerun:#, where # is the number from step 2.

  10. Select Next.

  11. Select Finish.

Previous Page | Next Page | Top of Page