| | |
Create EXE to delete files in TEMP Directory
![]() |
You could create a batch file that has the following commands in it: This code will remove the entire folder and then recreate it. If this folder has any type of lock on it, this code will be unable to remove the files.
This is by no means a robust solution, but it's simple and can work for you depending on what you're doing. If you want a more robust solution, I suggest you pick a programming language that you'd like to use and go to the appropriate location in the Software Dev forum.
rmdir /q /s c:\temp mkdir c:\temp
This is by no means a robust solution, but it's simple and can work for you depending on what you're doing. If you want a more robust solution, I suggest you pick a programming language that you'd like to use and go to the appropriate location in the Software Dev forum.
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Thanks for your suggestions.
I did quick research on Creating a Batch file and Commands in it.
This code will do the JOB.
I did quick research on Creating a Batch file and Commands in it.
This code will do the JOB.
@ECHO OFF del /q C:\TEMP\*.*
Save White Tiger
Perhaps, a more stable solution would be:
This will delete temp files in the designated temp directory, excluding any that are in use. Don't try this on DOS, because the %temp% variable is set to C:\DOS, so you'd end up deleting DOS
.
Also, if you wanted the code to execute any faster, you could convert it to a COM file. Google for "bat2exe" and run it on your batch file.
Hope that remotely helped,
@echo off echo Please wait, deleting temp files... cd %temp% echo This may take a while, depending on how long since you last did this. del *.* /Q echo Temporary files have been deleted.
This will delete temp files in the designated temp directory, excluding any that are in use. Don't try this on DOS, because the %temp% variable is set to C:\DOS, so you'd end up deleting DOS
.Also, if you wanted the code to execute any faster, you could convert it to a COM file. Google for "bat2exe" and run it on your batch file.
Hope that remotely helped,
Thanks,
I wont try that on my DOS.Did that long time ago?Had a bad exp with DEL *.*
I'm researching on COM now.
Any ideas on how to add these BAT files or COM files to Sytem Startup.
I know you can add it to the Sytem Registry but I'm not sure of the details?
Is there any other way like creating an EXE to store these files to System registry to load them on Start up.
I want to store this Bat file on system Startup,so that when I log onto Windows,It will clean TEMP and Other files.
PS: I'm not trying to create an Adware here.
I wont try that on my DOS.Did that long time ago?Had a bad exp with DEL *.*

I'm researching on COM now.
Any ideas on how to add these BAT files or COM files to Sytem Startup.
I know you can add it to the Sytem Registry but I'm not sure of the details?
Is there any other way like creating an EXE to store these files to System registry to load them on Start up.
I want to store this Bat file on system Startup,so that when I log onto Windows,It will clean TEMP and Other files.
PS: I'm not trying to create an Adware here.
Save White Tiger
You can put a shortcut to the file in your Startup folder of your Start Menu. That will result in having the file run each time you log in. Putting the same thing in the Registry isn't hard, but it doesn't sound like it's necessary since you can easily put a shortcut in the Startup folder.
Note that my solution is worth looking at because "del *.*" just deletes files and not folders. There is a problem of not being able to remove the folder that you are interested in however, so my solution has a major flaw as well.
As stated before, if you want a robust solution, find a programming language that you feel comfortable using in order to parse through the folder and remove any subdirectories and files from it.
Note that my solution is worth looking at because "del *.*" just deletes files and not folders. There is a problem of not being able to remove the folder that you are interested in however, so my solution has a major flaw as well.
As stated before, if you want a robust solution, find a programming language that you feel comfortable using in order to parse through the folder and remove any subdirectories and files from it.
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
![]() |
Similar Threads
- system cannot find the file specified (Windows NT / 2000 / XP)
- windows restarts cant delete files in temp folder (Viruses, Spyware and other Nasties)
- ie.content can't delete files (Web Browsers)
- fwvjqcmdte.exe (Windows NT / 2000 / XP)
Other Threads in the Windows NT / 2000 / XP Forum
- Previous Thread: Drive won't shut
- Next Thread: No standby option
Views: 5142 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for Windows NT / 2000 / XP
.net 64bit 2007 2010 a.exe activedirectory address android apache appstore arm black blue bluescreen boot bsod canonical cellphones chinese codeplex combofix computerfreezes cursor deployment desktop desktops dns downloads drive eartlink error explorer fax features firefox fontmanagers framework freeze gadgets home install intel interoperability laptop latitude linux login mac markshuttleworth microsoft minimalizes monitor netbooks novell nvidia opensource operatingsystems options oracle osx outlook palm partition patch port printer program proxy reformat remotedesktop repair replacingraiddrive rootkit screen sharepoint simplifiedchinese sitetositevpn sp3 spyware studios ubuntu unreadable update upgrade videodrivers videogames virus vista visual volume vpn vulnerability win win32/heur window windows windows7 windowsxp windowsxpnotstartingup. xp





