Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I've got a small batch file I use to "cleanup" every time the machine starts. But, for some reason on this particular machine it doesn't work... for example the following line(s) all return a "bad command or filename" error.
DELTREE /y C:\WINDOWS\TEMP\
On another machine (win95B) it works fine... any clues?

Bad command or file name means the command isn't in the current directory or in a directory listed in the path statement. Deltree is in the windows\command directory which is part of the default windows path. Either deltree isn't in windows\command or the default path has been changed.
But whatever the reason, you can copy deltree.exe to the root directory c:\ and it'll run then.

I assumed you had the command in autoexec.bat which is in the root directory. If your batch file is somewhere else you'd need to copy deltree to whatever directory it's in.

There's an old caveat about deleting your temp files on each bootup. Some/many software installations use the temp directory to dump installation files into. Then it's the "You must restart your computer to finish the installation....." This is where those files come into play. If the contents of the temp directory is deleted (through dos before windows loads), the installation cannot continue.
You would be better off to make a seperate batch file which can be "called" with the choice command from within autoexec.bat.

Take out the final backslash in your batch file line. This should fix the bad command error.
Whether the idea is good is a matter of conjecture. I "think" the temp file will be remade on booting but I am not certain. Others might know for certain.
Derek.W

The final \ is ok. I believe what that will do is delete all files and directories, but will leave the TEMP folder intact.
If you leave the backslash off, everything is deleted including the folder.If you still want to do this, even after Dan's advice, replace your command by
C:\Windows\Command\DELTREE /y C:\WINDOWS\TEMP\
Ie: Use the fully qualified name of the command

Hi Whitphil
I felt sure I'd got bad command after using final forward slash when I tested it out on a similar issue recently, hence my confidence. I did assume the poster wanted to delete the temp folder itself.
I will obviously fiddle about with this in order to complete my education but I know you far too well to be wrong.
Thanks for the correction therefore. Apologies to the poster for my mis-information - something I try hard to avoid.
Derek.W

WhitPhil is correct re; the parameters he outlined. If the backslash is left off the folder and everything below that is deleted, and the Windows registry will re-create the (empty) directory on the next boot, just like the recycle bin, applog, etc. (It's one of the "main established" folders of windows.)
"Use the fully qualified name of the command"
Ah, of the "old school". ;>) (That's the way I was taught, always provide the full path/command.)

Where can I read more about response number 3.
I wrote a "clean.bat" and stuck it in my autoexec too and have not had any trouble with installations involving rebooting - I'd like to perhaps test this out by installing something that does require the reboot and uses the temp folder.If it really does prevent completion of installation I'd like to make appropriate changes.

Just an aside here. Windows\TEMP folder is rebuilt in 98 by io.sys, not by Windows. 95 won't rebuild it all, just an odd feature of 98?
Tryan - it really does put the clobber on SOME installations, don't go there. Better solution is to run the batch weekly in preparation for defrag session or some such. And that would be AFTER getting into Windows at which time the installation files would have had their chance to install. Temp folder files don't build up so fast that a weekly run wouldn't take care of it.
Far more important is to keep on top of Temporary Internet Files as they can get out of hand in three days or so, don't use a batch file daily here either as they can't work properly, only use the Internet Options box if you want to do it the right way. Don't get me wrong, tweaking is OK but both these batch solutions are really over the edge. I been there and I done that and it's just no good.

"Windows\TEMP folder is rebuilt in 98 by io.sys, not by Windows."
Hmmm. I think you're wrong about that. I'll have to do an experiment and post back.
"...don't use a batch file daily here either as they can't work properly,.."
I use a batch file I wrote on the TIF's (among other things) and it works just fine.
It's on my webspace as well as Mesich's site (Mesich.com) under Freeware I believe. (Purge.zip)

melee5, you're quite correct about io.sys "rebuilding" the c:\windows\temp directory. I stand corrected. Thank You. (I'll go stand in the corner for five minutes.) ;>)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |