Re: Creating a .bat file?
- From: "Bill in Co." <not_really_here@xxxxxxxxxxxxx>
- Date: Fri, 4 Dec 2009 17:58:01 -0700
Kate wrote:
"Kate" <@*slamaspam*.demon.co.uk> wrote in message
news:%23cSj67TdKHA.2188@xxxxxxxxxxxxxxxxxxxxxxx
"Bill in Co." <not_really_here@xxxxxxxxxxxxx> wrote in message
news:OH3tw$SdKHA.5608@xxxxxxxxxxxxxxxxxxxxxxx
Kate wrote:
"Bill in Co." <not_really_here@xxxxxxxxxxxxx> wrote in message
news:uMEYLDSdKHA.2184@xxxxxxxxxxxxxxxxxxxxxxx
Kate wrote:Might this work, do you think?
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?
Many thanks
Kate
The syntax for doing something like that is like this:
del \windows\temp\trb*.tmp
(In this example we'd be referring to the \windows\temp folder).
This would delete all .tmp files in that folder beginning with
trb
You simply put that line above into a text file created with
Notepad, and rename that text file with a .bat extension. You
could call it erasetmp.bat.
del\Documents and Settings\(user name)\Local
Settings\Temp\PTM***.tmp
del\Documents and Settings\(user name)\Local
Settings\Temp\t*****.tmp
As already mentioned, you need to add a space after del command.
Also, make it t*.tmp in the batch file (just one asterisk is
allowed).
An alternate command would be t?????.tmp, but that's not needed
here, but that would specifically ONLY delete filenames (with t,
followed by 5 alphanumeric prefixes). The * is more global:
t*.tmp will delete any filename ending in .tmp that starts with the
letter t.
Does that mean the * can be letters and/or numbers,
Yes (as mentioned - it's a global substitute)
and is a .bat file case-sensitive?
No.
I have some TWAIN and Twunk files in my Temp folder
and although it doesn`t really matter if they are deleted as they
are
re-created when I next use my scanner, it would be more...elegant...
if the instructions could be targetted at just the Interlok files.
The .tmp files always have numbers and/or letters after the PTM or
t so I have used asterisks as wild-cards. Perhaps more
importantly, if it doesn`t work, can an incorrectly executed .bat
file cause problems elsewhere, do you know?
Well, if you really messed it up, you could delete some other files
you hadn't intended if they matched the conditions specified in the
batch file, which seems unlikely.
I know these files are useless after the program is closed as I have
been manually deleting them without ill-effects after each closure.
Most of the other files in my Local Settings/Temp folder are things
which just get re-created if I do delete them (see above), so I tend
to leave them alone. I think I will give the .bat file a try and see
how it goes. I suspect that if it works well, there will be quite a
few DxO Optics users celebrating, as it isn`t just me that finds
these Interlok files a PITA.
Thanks again to all.
Kate
It didn`t work. In fact, nothing beginning with a P or t (or even a p
or a T!) is being deleted, although I have checked the wording most
carefully and it all seems to be correct. Oh well, it looks like I
shall have to manually delete them after all. Disappointing.
Kate
I'm not sure exactly what the contents of your "erasetmp.bat" file looks
like. Maybe you can copy and paste it into here. The punctuation is
critical, of course. I assume you created a pure text file in *Notepad*.
Don't use a word processor for this - it needs to be a pure text file.
Here again is a simple one:
del c:\windows\*.tmp (note: space only after the del command)
would delete all .tmp files in that directory (after just double clicking on
the "erasetmp.bat" file it's written in).
.
- References:
- Re: Creating a .bat file?
- From: Bill in Co.
- Re: Creating a .bat file?
- From: Bill in Co.
- Re: Creating a .bat file?
- Prev by Date: Re: Creating a .bat file?
- Next by Date: Re: Creating a .bat file?
- Previous by thread: Re: Creating a .bat file?
- Next by thread: Re: Creating a .bat file?
- Index(es):
Relevant Pages
|