Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Batch file to clear data


  • Please log in to reply
6 replies to this topic

#1 travists

travists

  • Members
  • 11 posts
  • OFFLINE
  •  
  • Local time:12:58 AM

Posted 09 May 2011 - 12:34 PM

I have created a batch file to blow away temporary files.
Specificly:
(root)\windows\temp
(root)\windows\prefetch
(root)\windows\system32\drivers\etc ---We've found many bad things live here and little that harms the system by it's absence.
(user)\(temp)
(user)\(temporary Internet Files)

I have found help all over to build most of it, the trick I can't get it to do is kill the temp inet files in XP. It seemes to work fine in vista/7.
I know the windows dick cleanup will delete these files, but it takes too long to scan for what it can clean, and creating an automated script only works on that computer. Whereas my batch file is used to clean the main junk areas in a flash on any machine that needs it. I also know that while I.E. 6-current can dump some of this stuff it leaves stuff behind. It looks like the main issue is that in xp (root)\documents and settings\(username)\local settings\Temporary Internet Files is a "protected system folder". As such while in windows explorer you can show (then delete) those files it's blocking my batch. I can include the code if helpful, and am even willing to post the finished batch (with the understanding that it is "as is" and I may not be hanging around to support/update it.
Thanks for your help in advance. And please feel free to move this if needed, it just seemed like a tip/trick kind of thing.

BC AdBot (Login to Remove)

 


#2 karma428

karma428

  • Members
  • 5 posts
  • OFFLINE
  •  
  • Local time:03:58 AM

Posted 11 May 2011 - 07:58 AM

i hope this doesnt sound silly but how can i go about creating something so that my computer (XP) will clear away the files (especially the ones that you said a lot of little nasties were found) can i do it? would you mind helping me out? ty for your time...have a great day!!

#3 travists

travists
  • Topic Starter

  • Members
  • 11 posts
  • OFFLINE
  •  
  • Local time:12:58 AM

Posted 12 May 2011 - 02:40 PM

First of all, what skill level are you. Do you know what a batch file is? Are you comfortable at a command prompt? I can talk you through most what I have so far, but don't want you screwing up your computer or talking over your head.

#4 The Philosopher

The Philosopher

  • Members
  • 33 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Serbia
  • Local time:08:58 AM

Posted 17 May 2011 - 06:36 AM

This is good, but will not clear Java cache or Mozilla. Better solution is certainly TFC. Why would you spend time creating batch file, when there is excellent application. Everything that is needed is two clicks, and your temp files, cache, and other junk is clean. :) Amazing program this TFC, I am using it more than year and it is working his job perfectly!

Joshua

Edited by The Philosopher, 17 May 2011 - 06:37 AM.


#5 travists

travists
  • Topic Starter

  • Members
  • 11 posts
  • OFFLINE
  •  
  • Local time:12:58 AM

Posted 17 May 2011 - 11:19 AM

This is good, but will not clear Java cache or Mozilla. Better solution is certainly TFC. Why would you spend time creating batch file, when there is excellent application. Everything that is needed is two clicks, and your temp files, cache, and other junk is clean. :) Amazing program this TFC, I am using it more than year and it is working his job perfectly!

Joshua


Seems to take to long to run. This batch is intended to automate a process we are now doing manually, so I wasn't previously looking for a pre-written program.. TFC certainly did look promising, thanks for the tip. :thumbup2:

#6 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,259 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:12:58 AM

Posted 17 May 2011 - 01:54 PM

I have created a batch file to blow away temporary files.
Specificly:
(root)\windows\temp
(root)\windows\prefetch
(root)\windows\system32\drivers\etc ---We've found many bad things live here and little that harms the system by it's absence.
(user)\(temp)
(user)\(temporary Internet Files)


Clearing the Windows prefetch folder has no benefit, performance-wise. Rather the opposite, actually.

The %systemroot%\system32\drivers\etc\ directory is home to some very important files like your hosts, protocol and services files. While perhaps not immediately apparent, removing these files could have serious and subtle consequences.

I know the windows dick cleanup will delete these files, but it takes too long to scan for what it can clean

The built-in Windows Disk Cleanup wizard can be greatly sped up by disabling the "Compress Old Files" feature. This is done by deleting the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Compress old files registry key (be sure to make a backup before doing any registry editing!)

#7 travists

travists
  • Topic Starter

  • Members
  • 11 posts
  • OFFLINE
  •  
  • Local time:12:58 AM

Posted 17 May 2011 - 03:52 PM


I have created a batch file to blow away temporary files.
Specificly:
(root)\windows\temp
(root)\windows\prefetch
(root)\windows\system32\drivers\etc ---We've found many bad things live here and little that harms the system by it's absence.
(user)\(temp)
(user)\(temporary Internet Files)


Clearing the Windows prefetch folder has no benefit, performance-wise. Rather the opposite, actually.

The %systemroot%\system32\drivers\etc\ directory is home to some very important files like your hosts, protocol and services files. While perhaps not immediately apparent, removing these files could have serious and subtle consequences.

I know the windows dick cleanup will delete these files, but it takes too long to scan for what it can clean

The built-in Windows Disk Cleanup wizard can be greatly sped up by disabling the "Compress Old Files" feature. This is done by deleting the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Compress old files registry key (be sure to make a backup before doing any registry editing!)


The purpose of deleting prefetch is not a start up speed gain, but blowing out old stuff as part of a deep clean (virus removal, loaded down with cookies, etc.) that doesn't warrant combofix. And again, part of the trouble with windows disk cleanup is that any registry change must be done for each computer you want to clean. This is not to be used as a reoccurring task, but rather run on any computer that needs through maintenance. As to the etc folder, I'll pass that along, but adding that to our list of delete files came from my employer.
The purpose of the batch file is to speed up a process presently done manually.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users