You could create a batch file that has the following commands in it:
rmdir /q /s c:\temp
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.
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.
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.