Jump to content

Clean temp,cookies,index.dat and other junk files and folders at start


polas

Recommended Posts

Just put it in C:\Documents and Settings\user\Start Menu\Programs\Startup

when you start up windows it will pop up batch script and remove unusing junk files :)

this is very usefull when you want to be your pc clean in xp cd setup :D

@echo off
del /s /f /q c:\windows\temp\*.*
rd /s /q c:\windows\temp
md c:\windows\temp
del /s /f /q C:\WINDOWS\Prefetch
del /s /f /q %temp%\*.*
rd /s /q %temp%
md %temp%
deltree /y c:\windows\tempor~1
deltree /y c:\windows\temp
deltree /y c:\windows\tmp
deltree /y c:\windows\ff*.tmp
deltree /y c:\windows\history
deltree /y c:\windows\cookies
deltree /y c:\windows\recent
deltree /y c:\windows\spool\printers
del c:\WIN386.SWP
cls

Link to comment
Share on other sites


My suggestion is to use CCleaner. You can add the TEMP folder contents as well as the defaults (which work fine).

edit - WIN386.SWP on an XP machine? MAGIC!!!

Edited by submix8c
Link to comment
Share on other sites

The script (batch file) in post one, looks a lot like a takeoff on my own XPCleanup.bat program that I've posted before,

and even have on my private web site for download.

The clinker in that batch file is that "Deltree.exe" is not a part of Windows XP or any later OS.

I guess it was deemed 'too dangerous" by MS and they eliminated it.

If used improperly, it can delete an entire HD, with never a whimper.

For that batch file to actually work as written, "Deltree.exe" would have to be copied from an older OS like 98 or ME and installed into XP in the C:\Windows\System32 sub directory.

It's an 'external' DOS program and will run just fine in XP, but in Vista and Win-7, not so much.

On those OS's, instead of Deltree, I use "Echo Y| Del " followed by the path to the files I want deleted, inside quotes.

Indiscriminate? A properly written cleanup batch file would only delete things that really should be deleted anyway, like temporary internet files, temp files and other garbage that will build up in the HD forever, or till it fills up and crashes the HD.

A little common sense needs to be used with any batch file that can delete files.

My own XPCleanup.bat program is pretty generic and safe and I put it in the startup folder for every one of my customers.

On my own PC, I get a bit more detailed, including my Firefox cache files and unnecessary files generated by my AV and AS software.

I even include the virus vault.

CCleaner? It rendered my own HD NON-Bootable, , , twice. I don't want that program anywhere near my PC.

Apologies to all yous CC lovers.

Both "Easy Cleaner 2" and "AVG Tune-Up" work great and are completely safe.

Cheers Mates!

B)

Edited by Andromeda43
Link to comment
Share on other sites

For that batch file to actually work as written, "Deltree.exe" would have to be copied from an older OS like 98 or ME and installed into XP in the C:\Windows\System32 sub directory.

It's an 'external' DOS program and will run just fine in XP, but in Vista and Win-7, not so much.

On those OS's, instead of Deltree, I use "Echo Y| Del " followed by the path to the files I want deleted, inside quotes.

Deltree.exe could actually be located in the same directory as the batch file or any %PATH% location, not necessarily the system32 directory.

For many years and several Operating Systems there has been no need to pipe a Y response to a DELete command within a batch file.

On Windows 7, I'd suggest you familiarise yourself with powershell

Remove-Item <YourPath\*> -Recurse -Force

Link to comment
Share on other sites

CCleaner? It rendered my own HD NON-Bootable, , , twice.

No oftense, but the first thing that crosses my mind is PEBCAK. Or that you're blaming the crash on it with very little evidence to back it up.

I've used it on dozens of machines (using XP Pro, Vista x86, Vista x64 and Win7 x64) for a few years, and I've had exactly zero problems of any kind. We're millions of (happy) CCleaner users and google can't seemingly find any trace of evidence of such a problem either (if it was such a PC crasher, surely there would be lots of angry people). There is no logical reason it would make your machine non-bootable, and you didn't say either what it did to your machine to make it so.

Either ways, I wouldn't personally ever go back to using a batch file for this. There's just too many options that are far better (including also ncleaner, fcleaner and several others)

I second Yzöwl's recommendation too. While I use CCleaner (scheduled) on desktops, I also use powershell on servers for this (also scheduled to run automatically with the AT command). Like for cleaning up a shared folder which ends up cluttered with temp files. Remove-Item is the "real" command, but you can also use any of its aliases: del, erase, rd, ri, rm, rmdir. For example, our networked copier sends scannned documents in PDF format to a file share. Every night, the script runs and deletes files older than a week:


<#
Script to delete files older than a week. Scheduled to run every night automatically. Or whatever else comments you want in here.
#>

$aWeekAgo = (Get-date).AddDays(-7)
ls "Z:\Path\to\Somewhere" -r | where-object {$_.lastwritetime –lt $aWeekAgo} | rm

(feel free to replace "ls" by either "dir", "gci" or "Get-ChildItem" -- it all works the same but "ls" was only 2 characters)

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...