Jump to content

Day to day cleanup


Gabe The Nerd

Recommended Posts

Inspired by my cleanup.cmd file on my unattended disk, I set out to make a batch file that I can use for daily cleanup: emptying the recyle bin, deleting temporary internet and temp files, etc. I was wondering about a few things, like how can I delete the entire contents of a folder but not the folder itself? And how do I know when to use the "DEL" command and when to use the "RD /S /Q"? Any other tips like how to overwrite the files (making them unreadable) or anything like that would be welcome. I'm sure there are freeware programs that do just this and look better doing so, but it'd be cool to write it myself (with your help of course). Thanks. :D

Link to comment
Share on other sites


I use a ramdisk from (QSOFT) and have a reg file that defaults the temp, internet cache and cookies to the ramdrive. Then everytime it powers off, you have a clean pc, including the index.dat files. You need 1+ gig of ram though. The only time it is a problem is when a internet d/l is over the amount of ram you specify for the ram drive. When I know I have a bigger download, I disable it temporarily. It's works pretty slick for me.

aj

Edited by aspenjim
Link to comment
Share on other sites

You could just use TaskManager and Cleanupmgr.exe?

Automate Disk Cleanup

Cleanmgr.exe is designed to clear unnecessary files from your computer's hard disk. You can use command-line options to specify that Cleanmgr.exe cleans up certain files. You can then schedule the task to run at a specific time by using the Scheduled Tasks tool.

To start the Disk Cleanup tool, either run the Cleanmgr.exe command, or click Start, point to Programs, point to Accessories, point to System Tools, and then click Disk Cleanup.

Disk Cleanup supports the following command-line options:

/d driveletter: - This option specifies the drive that you want Disk Cleanup to clean.

/sageset: n - This option displays the Disk Cleanup Settings dialog box and also creates a registry key to store the settings that you select. The n value, which is stored in the registry, allows you to specify tasks for Disk Cleanup to run. The n value can be any integer value from 0 to 65535. To have all of the options available when you use the /sageset option, you might need to specify the drive where Windows is installed.

/sagerun: n - This option runs the specified tasks that are assigned to the n value if you use the \sageset option.

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

cleanmgr /sagerun:11

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

Why look anywhere else?

Link to comment
Share on other sites

I wrote that and after reading this post and i did not get
running the sagerun:99 from the run box the items need to be selected...........

It Just ran the script, with no selection box

You did not set the cleanmgr into registry.

Ay first you need to record the settings to registry.

cleanmgr.exe /dc /sageset:1

This is saved setting number 1, by using the /sageset: parameter.

/d is the chosen drive letter, c in this case.

When run, a window will open with checkboxes for each area to cleanup.

When user selected are checked, and ok is pressed, then it is recorded in registry.

Then you just need to set this command, to run from Task Manager.

cleanmgr /sagerun:1

That will run it at the set time by Taskmanager.

Automatic junk cleanup. No need for an extra program, as it would be more unneeded junk to the harddrive.

Link to comment
Share on other sites

CCleaner supports command line parameters. You can then use the task scheduler from the control panel to set it up to run every night and do all the cleanup you need.

Link to comment
Share on other sites

gunsmokingman,

run the cleanmgr.exe sagerun:99 from the run box, start --> run, it should popup w/ the diskcleanup wanting u to select the items to be cleaned, but it sounds like it will run w/out prompting using the vbs script..........

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...