philbill
Had this question 4
Question
philbill asked on

Disk Cleanup Task and "Cleanup System files"

If I schedule Disk Cleanup to run as a task and add the argument: /sagerun will this also "clean up system files" as well?  Or do I have to provide a script to press the "clean up system files" button?
Jessen P
Found this helpful 2
Answer
Jessen P replied on
Microsoft Support Engineer

Hi philbill,


Welcome to Microsoft Answers!!!

 

You can start the Disk Cleanup tool by running Cleanmgr.exe, or by clicking Start, pointing to Programs, pointing to Accessories, pointing to System Tools, and then clicking Disk Cleanup. Disk Cleanup supports the following command-line switches:

  • /d driveletter: - This switch selects the drive that you want Disk Cleanup to clean. Note that the /d switch is not used with /sagerun:n.
  • /sageset:n - This switch displays the Disk Cleanup Settings dialog box and creates 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. The n value can be any integer value from 0 to 65535. To get all the available options when you are using the /sageset switch, you may need to specify the drive letter that contains the Windows installation.
  • /sagerun:n - This switch runs the specified tasks that are assigned to the n value by using the \sageset switch. All drives in the computer will be enumerated, and the selected profile will be run against each drive.

    For example, in Scheduled Tasks, you could run the following command after running the cleanmgr /sageset:11 command:

cleanmgr /sagerun:11

This command runs Disk Cleanup with the options that were specified with the cleanmgr /sageset:11 command.

The available options for Disk Cleanup that you can specify by using the /sageset and /sagerun switches include:

  • Temporary Setup Files - These files should no longer be needed. They were originally created by a Setup program that is no longer running.
  • Downloaded Program Files - Downloaded program files are ActiveX controls and Java programs that are downloaded automatically from the Internet when you view certain pages. They are temporarily stored in the Downloaded Program Files folder on your hard disk. This option includes a View Files button that allows you to see the files that would be removed. The button opens the C:\Winnt\Downloaded Program Files folder.
  • Temporary Internet Files - The Temporary Internet Files folder contains Web pages that are stored on your hard disk for quick viewing. Your personalized settings for Web pages are left intact. This option includes a View Files button that displays the files to be deleted. The button opens the C:\Documents and Settings\Username\Local Settings\Temporary Internet Files\Content.IE5 folder.
  • Old Chkdsk Files - When Chkdsk checks your disk for errors, it might save lost file fragments as files in your disk's root folder. These files are unnecessary and can be removed.
  • Recycle Bin - The Recycle Bin contains files you have deleted from your computer. These files are not permanently removed until you empty the Recycle Bin. This option includes a View Files button that opens the Recycle Bin.
  • Temporary Files - Programs sometimes store temporary information in a Temp folder. Before a program quits, it usually deletes this information. You can safely delete temporary files that have not been modified in over a week.
  • Temporary Offline Files - Temporary offline files are local copies of recently used network files that are automatically cached for you so that you can use them when you are disconnected from the network. There is a View Files button that opens the Offline Files folder.
  • Offline Files - Temporary files are local copies of network files that you specifically made available offline so that you can use them when you are disconnected from the network. There is a View Files button that opens the Offline Files folder.
  • Compress Old Files - Windows can compress files that you have not used in a while. Compressing the files saves disk space while still enabling you to use them. No files are deleted. Because files are compressed at different rates, the displayed amount of disk space you will gain is approximate. There is an Options button that you can use to specify the number of days to wait before an unused file is compressed.
  • Catalog Files for the Content Indexer - The Indexing service speeds up and improves file searches by maintaining an index of the files on the disk. These files are left over from a previous indexing operation and can be deleted safely.

If you select the drive that contains the Windows installation, all of these options are available on the Disk Cleanup tab. If you select any other drive, only the Recycle Bin and Catalog files for content index options are available on the Disk Cleanup tab.

The More Options tab contains options for cleaning up Windows components or installed programs. You can use the Windows Components option to create free space by removing optional Windows components that you do not use. Clicking the Clean Up button for this option starts the Windows Components Wizard. You can use the Installed Programs option to free more disk space by removing programs that you do not use. Clicking this Clean Up button starts the Change or Remove Programs option in the Add/Remove Programs tool.

 

 

I would also suggest you to access the link below and read through the article in the link below for Information on Disk Clean up

 

http://windows.microsoft.com/en-us/windows7/Delete-files-using-Disk-Cleanup

 

 

Regards

Varun J: MICROSOFT SUPPORT

Visit our Microsoft Answers Feedback Forum

http://social.answers.microsoft.com/Forums/en-US/answersfeedback/threads/ and let us know what you think

 


If this post helps to resolve your issue, please click the "Mark as Answer" or "Helpful" button at the top of this message. By marking a post as Answered, or Helpful you help others find the answer faster.
Ronnie Vernon
Found this helpful 0
Answer
Ronnie Vernon replied on
MVP Community Moderator MCC: Content Creator

Reply

But does running these commands only clean up the users files or does it include what pressing the "clean up system files" button on the Windows 7 version would do?
Hi philbill

I don't think the clean up system files options can be supported from a scheduled task.

Using the 'Clean up system files' gives you 2 extra options. 

The capability to select and uninstall software programs and System Components from the Programs and Features/Uninstall or Change a Program list in the Control Panel, obviously cannot be defined in a scheduled task.

It also gives you the option to delete all but the most recent System Restore points and Shadow Copies. Performing this procedure from a command line requires a separate set of commands using 'vssadmin delete shadows'. Using these commands would require entering each unique ID number from the current list of system restore points.


Each of these options would require specific user interaction.

Hope this helps.

Thank You for using Windows 7

Ronnie Vernon MVP


Microsoft Windows MVP 1999 - Present

Mark the reply that answered your question
Jessen P
Found this helpful 2
Answer
Jessen P replied on
Microsoft Support Engineer

Hi philbill,


Welcome to Microsoft Answers!!!

 

You can start the Disk Cleanup tool by running Cleanmgr.exe, or by clicking Start, pointing to Programs, pointing to Accessories, pointing to System Tools, and then clicking Disk Cleanup. Disk Cleanup supports the following command-line switches:

  • /d driveletter: - This switch selects the drive that you want Disk Cleanup to clean. Note that the /d switch is not used with /sagerun:n.
  • /sageset:n - This switch displays the Disk Cleanup Settings dialog box and creates 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. The n value can be any integer value from 0 to 65535. To get all the available options when you are using the /sageset switch, you may need to specify the drive letter that contains the Windows installation.
  • /sagerun:n - This switch runs the specified tasks that are assigned to the n value by using the \sageset switch. All drives in the computer will be enumerated, and the selected profile will be run against each drive.

    For example, in Scheduled Tasks, you could run the following command after running the cleanmgr /sageset:11 command:

cleanmgr /sagerun:11

This command runs Disk Cleanup with the options that were specified with the cleanmgr /sageset:11 command.

The available options for Disk Cleanup that you can specify by using the /sageset and /sagerun switches include:

  • Temporary Setup Files - These files should no longer be needed. They were originally created by a Setup program that is no longer running.
  • Downloaded Program Files - Downloaded program files are ActiveX controls and Java programs that are downloaded automatically from the Internet when you view certain pages. They are temporarily stored in the Downloaded Program Files folder on your hard disk. This option includes a View Files button that allows you to see the files that would be removed. The button opens the C:\Winnt\Downloaded Program Files folder.
  • Temporary Internet Files - The Temporary Internet Files folder contains Web pages that are stored on your hard disk for quick viewing. Your personalized settings for Web pages are left intact. This option includes a View Files button that displays the files to be deleted. The button opens the C:\Documents and Settings\Username\Local Settings\Temporary Internet Files\Content.IE5 folder.
  • Old Chkdsk Files - When Chkdsk checks your disk for errors, it might save lost file fragments as files in your disk's root folder. These files are unnecessary and can be removed.
  • Recycle Bin - The Recycle Bin contains files you have deleted from your computer. These files are not permanently removed until you empty the Recycle Bin. This option includes a View Files button that opens the Recycle Bin.
  • Temporary Files - Programs sometimes store temporary information in a Temp folder. Before a program quits, it usually deletes this information. You can safely delete temporary files that have not been modified in over a week.
  • Temporary Offline Files - Temporary offline files are local copies of recently used network files that are automatically cached for you so that you can use them when you are disconnected from the network. There is a View Files button that opens the Offline Files folder.
  • Offline Files - Temporary files are local copies of network files that you specifically made available offline so that you can use them when you are disconnected from the network. There is a View Files button that opens the Offline Files folder.
  • Compress Old Files - Windows can compress files that you have not used in a while. Compressing the files saves disk space while still enabling you to use them. No files are deleted. Because files are compressed at different rates, the displayed amount of disk space you will gain is approximate. There is an Options button that you can use to specify the number of days to wait before an unused file is compressed.
  • Catalog Files for the Content Indexer - The Indexing service speeds up and improves file searches by maintaining an index of the files on the disk. These files are left over from a previous indexing operation and can be deleted safely.

If you select the drive that contains the Windows installation, all of these options are available on the Disk Cleanup tab. If you select any other drive, only the Recycle Bin and Catalog files for content index options are available on the Disk Cleanup tab.

The More Options tab contains options for cleaning up Windows components or installed programs. You can use the Windows Components option to create free space by removing optional Windows components that you do not use. Clicking the Clean Up button for this option starts the Windows Components Wizard. You can use the Installed Programs option to free more disk space by removing programs that you do not use. Clicking this Clean Up button starts the Change or Remove Programs option in the Add/Remove Programs tool.

 

 

I would also suggest you to access the link below and read through the article in the link below for Information on Disk Clean up

 

http://windows.microsoft.com/en-us/windows7/Delete-files-using-Disk-Cleanup

 

 

Regards

Varun J: MICROSOFT SUPPORT

Visit our Microsoft Answers Feedback Forum

http://social.answers.microsoft.com/Forums/en-US/answersfeedback/threads/ and let us know what you think

 


If this post helps to resolve your issue, please click the "Mark as Answer" or "Helpful" button at the top of this message. By marking a post as Answered, or Helpful you help others find the answer faster.
philbill
Found this helpful 0
philbill replied on

Reply

But does running these commands only clean up the users files or does it include what pressing the "clean up system files" button on the Windows 7 version would do?
Ronnie Vernon
Found this helpful 0
Answer
Ronnie Vernon replied on
MVP Community Moderator MCC: Content Creator

Reply

But does running these commands only clean up the users files or does it include what pressing the "clean up system files" button on the Windows 7 version would do?
Hi philbill

I don't think the clean up system files options can be supported from a scheduled task.

Using the 'Clean up system files' gives you 2 extra options. 

The capability to select and uninstall software programs and System Components from the Programs and Features/Uninstall or Change a Program list in the Control Panel, obviously cannot be defined in a scheduled task.

It also gives you the option to delete all but the most recent System Restore points and Shadow Copies. Performing this procedure from a command line requires a separate set of commands using 'vssadmin delete shadows'. Using these commands would require entering each unique ID number from the current list of system restore points.


Each of these options would require specific user interaction.

Hope this helps.

Thank You for using Windows 7

Ronnie Vernon MVP


Microsoft Windows MVP 1999 - Present

Mark the reply that answered your question