How to code a batch file to delete specific folder?

E

Eric

Does anyone have any suggestions on how to code a batch file to delete all
files and sub trees under following directory?
C:\Documents and Settings\Default User\Local Settings\Temp
Thanks in advance for any suggestions
Eric
 
P

Pegasus [MVP]

Eric said:
Does anyone have any suggestions on how to code a batch file to delete all
files and sub trees under following directory?
C:\Documents and Settings\Default User\Local Settings\Temp
Thanks in advance for any suggestions
Eric

Here you go:
@echo off
rd /s /q "C:\Documents and Settings\Default User\Local Settings\Temp"
md "C:\Documents and Settings\Default User\Local Settings\Temp"

Whether it is a wise idea to play around with the Default User profile
folder is another question.
 
E

Eric

If any file is currently used under this directory, this batch file cannot
delete them. Does it right?
Thank you very much for suggestions
Eric
 
P

Pegasus [MVP]

Correct. There is next to nothing that will delete a file that is currently
in use. However, it does not matter: The batch file I gave you will do what
you asked for, within the restrictions imposed by the operating system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top