Question:
Help with batch file?
CowzRule101
2009-06-15 12:51:47 UTC
I want to create a batch file that deletes the contents of the following file:
C:\Documents and Settings\Administrator\Local Settings\Temp

All I've figured out is that the batch files I have created only delete contents from my desktop... and not from any other section.

What is the correct command?
Three answers:
miha49
2009-06-15 12:58:59 UTC
You might get hung up on the spaces that would be in the command. Try this:



erase "C:\Documents and Settings\Administrator\Local Settings\Temp"



Additional reply after asker contacted me and said that was a folder name, not a file name. Here is the additional info:



Well, that would not have erased the folder anyway. The way you wrote the question, you made it sound like that was the name of the file. The following will delete all files in that folder:



erase "C:\Documents and Settings\Administrator\Local Settings\Temp\*.*"



If you do not want to be prompted to ask whether you really want to delete the files, then use this:



erase "C:\Documents and Settings\Administrator\Local Settings\Temp\*.*" /q



If you also want to delete the files in any subdirectories in that folder then you can use:



erase "C:\Documents and Settings\Administrator\Local Settings\Temp\*.*" /s



If you want both parameters, then you can do that too:



erase "C:\Documents and Settings\Administrator\Local Settings\Temp\*.*" /q /s



This will not remove the subdirectories, just the files in them. You need to do RMDIR for each directory to do that.
Kelruze
2009-06-16 11:20:33 UTC
This is the command,



Del "C:\Documents and Settings\%username%\Local Settings\Temp\*.*" /f /q
anonymous
2016-11-14 09:17:28 UTC
Ratchetr is stable: echo hi > try.txt "hi" is the content textile of the report "try.txt" is the area of the report use a single > to create your report or 2 >> to function contents on your report echo international >> try.txt


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...