How to code a batch file to delete specific folder?

  • Thread starter Thread starter Eric
  • Start date Start date
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
 
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.
 
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
 
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.
 
Back
Top