View Single Post
  #5  
Old December 4th 09, 08:02 PM posted to microsoft.public.windowsxp.help_and_support
John John - MVP[_2_]
external usenet poster
 
Posts: 1,637
Default Creating a .bat file?

Kate wrote:
XP Home SP3
Apologies if this is not the place to ask this question, but I would
like to create a .bat file or something to delete the dozens of temp
files which a program I have leaves in my Temp folder every time I run
it. The files are always named in a particular way so can easily be
identified, I think/hope. I do not want to delete all of the files in
the Temp folder, though. Is this possible, please, and how would I go
about it?


Trying something like this at the command prompt should give you ideas:

for %f in (c:\"Temp Folder Name"\*.tmp) do @echo %f

The above is perfectly safe, it will only echo file names. To delete
files replace the @echo command with del and surround the variable with
quotation marks, the quotation marks are needed if the filenames
contains spaces. At the Command Prompt use single %, in a batch file
double them up:

for %%f in (c:\"Temp Folder Name"\*.tmp) do del "%%f"

Careful!!! files deleted by batch file or at the Command Prompt do not
go to the Recycle Bin!

John
Ads