The purpose of this hack is to have Windows automatically run the Disk Cleanup utility. We will specify some settings for default to keep your machine clean and optimized!
Open Notepad and type the following:
-
C:\windows\system32\cleanmgr.exe /dc sageset: 1
Save the file, but change the extension to .bat

Run the file. This runs Window’s Disk Cleanup utility and lets you select what you want to delete. Whatever you choose here will be remembered every time you run the file (You can change these later if you choose). I select everything except for the Recycle Bin. This way, if I need to recover a document, I still can.

Now right-click your batch (.bat) file, choose Edit

Change the first line to read:
-
C:\windows\system32\cleanmgr.exe /dc /sagerun: 1
Save and exit the file. From now on, every time you run this file, you machine will be fresh and clean! Now let’s get fancy:
Applying An Icon To Your Batch File
Windows will not allow you to apply an icon to this file – BUT it will let you give a shortcut an icon!
- Move your batch file to another location, i.e.
C:\Program Files\ - Right-click the batch file and click “Create Shortcut”

- Right-click the shortcut and click properties
- Under the “Shortcut” tab, click “Change Icon . . .” This will pop-up the following error:

- After clicking “OK”, a dialog should open displaying all of the icons in the location:
%SystemRoot%\system32\SHELL32.dll - Find one that you like and click “OK”

- You could get nutty and place this shortcut in your Quick Launch folder by typing Windows Key+R, then:
"C:\Documents and Settings\%username%\Application Data\Microsoft\Internet Explorer\Quick Launch"

Download
You can download both versions of this application (the first is the configuration and the second is the actual program). Just remember to save the file with a .bat extension.
hey, do you know why i can’t run this through scheduled tasks? it always comes up with an error of 0×1 whenever I try to run it.
When I run the file itself, it works fine.
Actually, after I do the sageset thing, I can just run “C:\windows\system32\cleanmgr.exe” on scheduled tasks and it does it automatically
without having to choose the drive and the other stuff…
lol… crazy
but i noticed when you run it initially, it skips the part where you have to choose a drive to clean up, and automatically picks C:. How would you pick another drive to clean up instead?
EDIT: just figured it out. just change the /dc to /d[letter]
So, can you run it as a scheduled task?
yup, it works now. =D
Hai i want to restart or lock my nearst computer from CAMOND PROMPT how…………..?
Checkout this post: Windows Tip: Shutdown Your Computer With The Command Prompt
have you found a way to run the disk cleanup via the sagerun switch where it is hidden to the user or with the “cancel” button disabled?
Thanks for the info, gonna need it with all the junk on my PC
bracknell cleaning´s last blog ..Berkshire Cleaning – Cleaners in Bracknell, Reading & Slough