A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » Windows XP Help and Support
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Creating a .bat file?



 
 
Thread Tools Display Modes
  #1  
Old December 4th 09, 08:13 PM posted to microsoft.public.windowsxp.help_and_support
Kate
external usenet poster
 
Posts: 121
Default Creating a .bat file?

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

Ads
  #2  
Old December 4th 09, 08:25 PM posted to microsoft.public.windowsxp.help_and_support
Leonard Grey[_3_]
external usenet poster
 
Posts: 3,048
Default Creating a .bat file?

Without knowing what program you're talking about, what kind of
temporary files it creates and why, it's impossible to advise you on the
wisdom of deleting these files.

But if you're bound and determined to get rid of them, try the Disk
Cleanup Wizard in Windows, or one of the millions of programs available
for download that do this. (CCleaner is often mentioned here.)
---
Leonard Grey
Errare humanum est

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?

Many thanks
Kate

  #3  
Old December 4th 09, 08:47 PM posted to microsoft.public.windowsxp.help_and_support
Kate
external usenet poster
 
Posts: 121
Default Creating a .bat file?

Thanks for the reply.
I would like to be able to just click, say, a shortcut after I had run
the program, rather than open another program to "search and destroy".
I might as well open the Temp folder and delete them manually,
otherwise. The files are created by Pace Interlok and are totally
unnecessary to the subsequent running of the program. Indeed, each
time the program is opened, yet another load of files are saved rather
than it using the existing ones and they can multiply to such an
extent that they number in their 100s if I don`t clear up each time.
The program that uses Interlok is DxO Optics, a very good RAW
converter, and it is a pity that they use such intrusive anti-piracy
software.
Thanks again
Kate

"Leonard Grey" wrote in message
...
Without knowing what program you're talking about, what kind of
temporary files it creates and why, it's impossible to advise you on
the wisdom of deleting these files.

But if you're bound and determined to get rid of them, try the Disk
Cleanup Wizard in Windows, or one of the millions of programs
available for download that do this. (CCleaner is often mentioned
here.)
---
Leonard Grey
Errare humanum est

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?

Many thanks
Kate


  #4  
Old December 4th 09, 08:56 PM posted to microsoft.public.windowsxp.help_and_support
Leonard Grey[_3_]
external usenet poster
 
Posts: 3,048
Default Creating a .bat file?

I clean out temp files (with CCleaner) in two clicks. If you can stomach
one extra click, you don't need to learn about batch files or take the
risk of making a mistake.
---
Leonard Grey
Errare humanum est

Kate wrote:
Thanks for the reply.
I would like to be able to just click, say, a shortcut after I had run
the program, rather than open another program to "search and destroy".
I might as well open the Temp folder and delete them manually,
otherwise. The files are created by Pace Interlok and are totally
unnecessary to the subsequent running of the program. Indeed, each
time the program is opened, yet another load of files are saved rather
than it using the existing ones and they can multiply to such an
extent that they number in their 100s if I don`t clear up each time.
The program that uses Interlok is DxO Optics, a very good RAW
converter, and it is a pity that they use such intrusive anti-piracy
software.
Thanks again
Kate

"Leonard Grey" wrote in message
...
Without knowing what program you're talking about, what kind of
temporary files it creates and why, it's impossible to advise you on
the wisdom of deleting these files.

But if you're bound and determined to get rid of them, try the Disk
Cleanup Wizard in Windows, or one of the millions of programs
available for download that do this. (CCleaner is often mentioned
here.)
---
Leonard Grey
Errare humanum est

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?

Many thanks
Kate


  #5  
Old December 4th 09, 09: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
  #6  
Old December 4th 09, 09:10 PM posted to microsoft.public.windowsxp.help_and_support
Kate
external usenet poster
 
Posts: 121
Default Creating a .bat file?

Does CCleaner clear the entire Temp folder, or can I specify which
files I want deleted, please? Incidentally, I thought that temp files
were just that : temporary, and could be deleted with impunity unless
a program was actually running and using them.

Kate

"Leonard Grey" wrote in message
...
I clean out temp files (with CCleaner) in two clicks. If you can
stomach one extra click, you don't need to learn about batch files or
take the risk of making a mistake.
---
Leonard Grey
Errare humanum est

Kate wrote:
Thanks for the reply.
I would like to be able to just click, say, a shortcut after I had
run
the program, rather than open another program to "search and
destroy".
I might as well open the Temp folder and delete them manually,
otherwise. The files are created by Pace Interlok and are totally
unnecessary to the subsequent running of the program. Indeed, each
time the program is opened, yet another load of files are saved
rather
than it using the existing ones and they can multiply to such an
extent that they number in their 100s if I don`t clear up each
time.
The program that uses Interlok is DxO Optics, a very good RAW
converter, and it is a pity that they use such intrusive
anti-piracy
software.
Thanks again
Kate

"Leonard Grey" wrote in message
...
Without knowing what program you're talking about, what kind of
temporary files it creates and why, it's impossible to advise you
on
the wisdom of deleting these files.

But if you're bound and determined to get rid of them, try the
Disk
Cleanup Wizard in Windows, or one of the millions of programs
available for download that do this. (CCleaner is often mentioned
here.)
---
Leonard Grey
Errare humanum est

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?

Many thanks
Kate



  #7  
Old December 4th 09, 09:31 PM posted to microsoft.public.windowsxp.help_and_support
Bill in Co.
external usenet poster
 
Posts: 3,106
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?

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.


  #8  
Old December 4th 09, 09:32 PM posted to microsoft.public.windowsxp.help_and_support
Ken Blake, MVP
external usenet poster
 
Posts: 10,402
Default Creating a .bat file?

On Fri, 4 Dec 2009 20:10:10 -0000, "Kate"
wrote:

Incidentally, I thought that temp files
were just that : temporary,



Yes, exactly. However, every now and then they get left behind,
usually because the program that created them doesn't close normally.


and could be deleted with impunity unless
a program was actually running and using them.



Yes, however you can always delete (at least try to delete) them with
impunity. You won't be permitted to delete one if a running program is
using it.


--
Ken Blake, Microsoft MVP (Windows Desktop Experience) since 2003
Please Reply to the Newsgroup
  #9  
Old December 4th 09, 09:58 PM posted to microsoft.public.windowsxp.help_and_support
Leonard Grey[_3_]
external usenet poster
 
Posts: 3,048
Default Creating a .bat file?

Ccleaner cleans the Windows temporary folder and you can specify
additional folders to clean out.

Temporary files cannot be cleaned out 'with impunity'. Sometimes they
hold information a program needs, albeit temporarily.

I'm not making some kind of product endorsement for CCleaner. My point
is, why re-invent the wheel?
---
Leonard Grey
Errare humanum est

Kate wrote:
Does CCleaner clear the entire Temp folder, or can I specify which
files I want deleted, please? Incidentally, I thought that temp files
were just that : temporary, and could be deleted with impunity unless
a program was actually running and using them.

Kate

"Leonard Grey" wrote in message
...
I clean out temp files (with CCleaner) in two clicks. If you can
stomach one extra click, you don't need to learn about batch files or
take the risk of making a mistake.
---
Leonard Grey
Errare humanum est

Kate wrote:
Thanks for the reply.
I would like to be able to just click, say, a shortcut after I had
run
the program, rather than open another program to "search and
destroy".
I might as well open the Temp folder and delete them manually,
otherwise. The files are created by Pace Interlok and are totally
unnecessary to the subsequent running of the program. Indeed, each
time the program is opened, yet another load of files are saved
rather
than it using the existing ones and they can multiply to such an
extent that they number in their 100s if I don`t clear up each
time.
The program that uses Interlok is DxO Optics, a very good RAW
converter, and it is a pity that they use such intrusive
anti-piracy
software.
Thanks again
Kate

"Leonard Grey" wrote in message
...
Without knowing what program you're talking about, what kind of
temporary files it creates and why, it's impossible to advise you
on
the wisdom of deleting these files.

But if you're bound and determined to get rid of them, try the
Disk
Cleanup Wizard in Windows, or one of the millions of programs
available for download that do this. (CCleaner is often mentioned
here.)
---
Leonard Grey
Errare humanum est

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?

Many thanks
Kate



  #10  
Old December 4th 09, 10:24 PM posted to microsoft.public.windowsxp.help_and_support
Kate
external usenet poster
 
Posts: 121
Default Creating a .bat file?


"Bill in Co." wrote in message
...
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?

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.

Might this work, do you think?
del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp
del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp

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?

Thanks to everyone who replied
Kate

  #11  
Old December 4th 09, 10:43 PM posted to microsoft.public.windowsxp.help_and_support
Bill Sharpe
external usenet poster
 
Posts: 617
Default Creating a .bat file?

Kate wrote:


Might this work, do you think?
del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp
del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp

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?

Thanks to everyone who replied
Kate


These should work, but leave a space after "del". Also, you only need
one asterisk, not multiple asterisks in these commands.

Bill
  #12  
Old December 4th 09, 10:48 PM posted to microsoft.public.windowsxp.help_and_support
Ken Blake, MVP
external usenet poster
 
Posts: 10,402
Default Creating a .bat file?

On Fri, 4 Dec 2009 21:24:38 -0000, "Kate"
wrote:


"Bill in Co." wrote in message
...
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?

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.

Might this work, do you think?
del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp
del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp



Note that there needs to be a space after the del.


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?



An asterisk means some number of characters and you can't use multiple
asterisks that way. Use a question mark as wildcard for a single
character.

But why do you want to specify what files you want to delete? Just
delete all the files in the temp folder. Personally I think the
easiest way to do that is to go to the temp folder in Windows
Explorer, sort all the files by date with the oldest on top, select
them all with Ctrl-A, then press the delete key to delete them all. It
will delete everything until it gets to the newest ones that are still
being used.

--
Ken Blake, Microsoft MVP (Windows Desktop Experience) since 2003
Please Reply to the Newsgroup
  #13  
Old December 4th 09, 11:10 PM posted to microsoft.public.windowsxp.help_and_support
Bill in Co.
external usenet poster
 
Posts: 3,106
Default Creating a .bat file?

Ken Blake, MVP wrote:
On Fri, 4 Dec 2009 21:24:38 -0000, "Kate"
wrote:


"Bill in Co." wrote in message
...
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?

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.

Might this work, do you think?
del\Documents and Settings\(user name)\Local Settings\Temp\PTM***.tmp
del\Documents and Settings\(user name)\Local Settings\Temp\t*****.tmp



Note that there needs to be a space after the del.


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?



An asterisk means some number of characters and you can't use multiple
asterisks that way. Use a question mark as wildcard for a single
character.

But why do you want to specify what files you want to delete? Just
delete all the files in the temp folder.


I wouldn't do that, for a couple of reasons. One is for the history
(sometimes I'm chasing down some bugs or mods, and it's helpful to see what
was left or created in there), and the other reason is that sometimes some
temp files are there as part of a program install or uninstall (although
they might be locked, in which case it's not an issue, admitedly). So my
feeling is, why not just delete the undesired ones, and perhaps even know or
be able to determine what app is creating them in the process.

Personally I think the
easiest way to do that is to go to the temp folder in Windows
Explorer, sort all the files by date with the oldest on top, select
them all with Ctrl-A, then press the delete key to delete them all. It
will delete everything until it gets to the newest ones that are still
being used.

--
Ken Blake, Microsoft MVP (Windows Desktop Experience) since 2003
Please Reply to the Newsgroup



  #14  
Old December 4th 09, 11:20 PM posted to microsoft.public.windowsxp.help_and_support
Bill in Co.
external usenet poster
 
Posts: 3,106
Default Creating a .bat file?

Kate wrote:
"Bill in Co." wrote in message
...
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?

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.

Might this work, do you think?
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.

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.


  #15  
Old December 5th 09, 01:07 AM posted to microsoft.public.windowsxp.help_and_support
Kate
external usenet poster
 
Posts: 121
Default Creating a .bat file?


"Bill in Co." wrote in message
...
Kate wrote:
"Bill in Co." wrote in message
...
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?

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.

Might this work, do you think?
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, and is a .bat file
case-sensitive? 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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 12:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.