There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Batch File


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
MikeSwim07's Avatar
Computer Specs
Distinguished Member with 4,206 posts.
 
Join Date: Apr 2007
Location: Cleveland, Ohio
Experience: Training at MRU
15-Mar-2008, 01:08 PM #1
Batch File
How would I make a batch file that deletes the temprary files of windows

C:\WINDOWS\Temp
C:\Documents and Settings\Username\Local Settings\Temp
C:\Documents and Settings\Username\COOKIES
C:\Documents and Settings\Username\Local Settings\Temporary Internet Files

Thanks.
demortes's Avatar
Computer Specs
Member with 98 posts.
 
Join Date: Mar 2007
Location: Sioux City, Iowa, USA, Earth
Experience: Advanced
15-Mar-2008, 01:21 PM #2
There are many tutorials on how to use DOS commands. In a quick sense you'd run
deltree C:\Documents and Settings\Username\Local Settings\Temp\*
etc
MikeSwim07's Avatar
Computer Specs
Distinguished Member with 4,206 posts.
 
Join Date: Apr 2007
Location: Cleveland, Ohio
Experience: Training at MRU
15-Mar-2008, 04:57 PM #3
I don't want to delete the folder and the subfolder, just the contents.
demortes's Avatar
Computer Specs
Member with 98 posts.
 
Join Date: Mar 2007
Location: Sioux City, Iowa, USA, Earth
Experience: Advanced
15-Mar-2008, 05:38 PM #4
deltree with empty subfolders, but not the folder itself. (The * after the / says do not delete the first folder).

Let's say C:\Documents and Settings\Username\Local Settings\Temp\ has a folder FOOD in it.
It will delete FOOD, but not Temp, with the command:
deltree C:\Documents and Settings\Username\Local Settings\Temp\*

But don't quote me. research it Try it.... I use Linux for a lot of my text based stuff....
AKAJohnDoe's Avatar
Senior Member with 179 posts.
 
Join Date: Jun 2007
Experience: Advanced
15-Mar-2008, 05:55 PM #5
You can also be in the directory, delete everything in it, piping the "Y" response back to the delete or erase command.

cd\MYDIR
mkdir MYDIR2
cd..
echo.Y|del *.*
cd..

All the files in MYDIR should have been deleted. MYDIR will still exist. And any directories under MYDIR and MYDIR2 should also still exist as should any files under MYDIR2.

If you don't want to see the noise redirect the output. e.g.: echo.Y|del *.* >NUL
Or, if you do want to see it, redirect it to a file. e.g.: echo.Y|del *.* >>C:\cleanuplog.txt
Two >> appends, One > creates.
__________________
http://www.AKAJohnDoe.com

Last edited by AKAJohnDoe : 15-Mar-2008 09:56 PM.
AKAJohnDoe's Avatar
Senior Member with 179 posts.
 
Join Date: Jun 2007
Experience: Advanced
15-Mar-2008, 06:47 PM #6
However, what I do is use Firefox, set the options to clear cache/cookies/history/etc at exit, and use CCleaner now and again.
devil_himself's Avatar
Distinguished Member with 4,819 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
15-Mar-2008, 09:04 PM #7
Edit -- Read Above ... You Don't Want To Delete Subfolders

Code:
DEL /S /Q /F "%TEMP%\*.*"
AKAJohnDoe's Avatar
Senior Member with 179 posts.
 
Join Date: Jun 2007
Experience: Advanced
15-Mar-2008, 09:55 PM #8
Quote:
Originally Posted by devil_himself View Post
Edit -- Read Above ... You Don't Want To Delete Subfolders

Code:
DEL /S /Q /F "%TEMP%\*.*"
That code will delete *.* from all subdirectories.

Last edited by AKAJohnDoe : 15-Mar-2008 10:07 PM.
demortes's Avatar
Computer Specs
Member with 98 posts.
 
Join Date: Mar 2007
Location: Sioux City, Iowa, USA, Earth
Experience: Advanced
15-Mar-2008, 10:36 PM #9
Why nto delete subfolders. They arn't needed for the operation of the computer. Anything in the TEMP folders can be deleted. A friend tells me the TEMP folder can even be deleted without affect, it just recreates it.
AKAJohnDoe's Avatar
Senior Member with 179 posts.
 
Join Date: Jun 2007
Experience: Advanced
15-Mar-2008, 10:42 PM #10
I used to run this to let me selective delete files and directories, but now use CCleaner.
Attached Thumbnails
batch-file-cucmd.jpg  
demortes's Avatar
Computer Specs
Member with 98 posts.
 
Join Date: Mar 2007
Location: Sioux City, Iowa, USA, Earth
Experience: Advanced
15-Mar-2008, 10:56 PM #11
One question... what was the point of that? why not post the "code", instead of an image of the code?
AKAJohnDoe's Avatar
Senior Member with 179 posts.
 
Join Date: Jun 2007
Experience: Advanced
16-Mar-2008, 09:08 AM #12
The forum will not permit a direct upload of a .cmd file, so rather than renaming it .txt or zipping it I simply took a screen snapshot and uploaded that.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:29 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.